Getting error while running simple javascript using node framework

Javascriptnode.js

Javascript Problem Overview


As I run this piece of code using node a.js:

var sys = require('sys');
sys.puts('Hello, World');

I'm getting the following as an error

> axconfig: port 1 not active > > axconfig: port 2 not active

Javascript Solutions


Solution 1 - Javascript

Warning: This is old but it might still work.

You didn't install node.js but the package node (that contains some other unrelated software) for your linux distro.

You can install node.js three ways: Using git, downloading the version file, or installing through the package manager, I recommend using the package manager for ease-of-use and the ability to easily update.

Package Manager

Check out Installing Node.js via Package Manager. It has instructions on how to install using the package manager of your preference.

Direct Download

Go the the downloads page of node.js and download the package for your OS. Don't forget that, doing i this way, doesn't auto-update node.js later on!

Source Compilation / git

First you need git and a compiler, here is how you install them on debian/ubuntu (this depends on your package manager):

sudo apt-get install git-core build-essential

(If you don't want to use git, you can download the source code from the website. You still need build-essential or equivalent for your OS.)

Then go to a folder where the "node" repository will be placed, something like ~/projects or ~/src is good enough, and do this:

git clone https://github.com/joyent/node.git

Then enter the node directory, configure it and build it.

cd node && ./configure && make

Everything should go well. Before installing node you can optionally run the tests to check for any problems:

make test

You can finally install node, this allows you to run the node command anywhere in the system and the javascript libraries to be installed.

make install

...and we are done. You can test those lines of code using node-repl (node's REPL, think "interactive interpreter"), just type node-repl, quit with Ctrl+D.

Solution 2 - Javascript

> axconfig: port 1 not active > axconfig: port 2 not active

this problem no where related to nodejs.

Do not install node using the command sudo apt-get install node, This will install radio package(node). this radio package requires axports to be active, which is not linked with nodejs

So uninstall node from sudo apt-get remove node

Manually Download nodejs from Here or from GitHub but make sure you install the stable branch(0.4.x).Unpack the nodejs.

For installing please follow the README.md

After installing then set the environment variables echo PATH=$PATH:/home/user/pathtonode/

Solution 3 - Javascript

you installed node, you want the package called nodejs

Solution 4 - Javascript

If you are on ubuntu, follow:

sudo apt-get update
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

You need to install nodejs and not node!

Solution 5 - Javascript

Brandon Helwig is correct. It just happened to me. In general, if you get this type of error, you have installed the wrong package. Here are more instructions for you to install one of the latest versions of Node.js.

Fix

sudo apt-get remove node 

This will remove the accidentally installed package. Both names for the package node and nodejs are the same which is node.

If you do sudo apt-get install node, what you would get is a old version. But thanks for Chris Lea, we got a PPA for this task.

sudo apt-get update
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

This should get you the latest version of Node.js in your application.

If you are in need of an bleeding edge version, you can install from the source. But I think this is way cleaner.

Solution 6 - Javascript

This problem is occur in ubuntu,so I resolved this problem by git. Clone this new source from github and do following actions:

  1. Uninstall node

    sudo apt-get remove --pure node
    sudo apt-get clean

  2. Make install node

    git clone https://github.com/joyent/node.git
    cd node
    ./configure
    make
    make install

Then this will be work well.

Solution 7 - Javascript

If Node.js installation as suggested by ninja works for you (like on AWS Ubuntu):

sudo apt-get update
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

you might still want to add node to your system path like this:

export PATH=/usr/bin/:$PATH

so you can type

node webapp.js

instead of

/usr/bin/node webapp.js

Find your node installation path simply by typing

which node

Solution 8 - Javascript

The easiest way is to remove the node installation first and then install npm. npm is the Node Package Manager, this will automatically install nodejs itself

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser291390View Question on Stackoverflow
Solution 1 - JavascriptDiogo GomesView Answer on Stackoverflow
Solution 2 - JavascriptMunipratapView Answer on Stackoverflow
Solution 3 - JavascriptBrandon HelwigView Answer on Stackoverflow
Solution 4 - JavascriptninjaView Answer on Stackoverflow
Solution 5 - JavascriptZiyan JunaideenView Answer on Stackoverflow
Solution 6 - JavascripthuipView Answer on Stackoverflow
Solution 7 - JavascriptOliver SchafeldView Answer on Stackoverflow
Solution 8 - JavascriptastroanuView Answer on Stackoverflow