Ubuntu – Having some trouble installing node package manager

node.jsUbuntuubuntu-10.10

I installed node.js with these commands:

$ sudo git clone --depth 1 https://github.com/joyent/node.git
$ cd node
$ export JOBS=2
$ sudo mkdir ~/local
$ sudo ./configure --prefix=$HOME/local/node
$ sudo make
$ sudo make install
$ export PATH=$HOME/local/node/bin:$PATH

It executed without error. Not sure how to confirm that node.js is actually installed though.

I then tried to install node package manager with the following commands:

$ sudo git clone http://github.com/isaacs/npm.git
$ cd npm
$ sudo make install

The last command had a lot of output but the last few lines were:

make[1]: Entering directory `/var/www/node/npm'

node cli.js install https://github.com/isaacs/ronnjs/tarball/master

bash: node: command not found

make[1]: *** [node_modules/ronn] Error 127

make[1]: Leaving directory `/var/www/node/npm'

make: *** [man/man3/author.3] Error 2

npm does not get installed, but the directory is there. Not sure what I need to do?

Best Answer

On ubuntu your path is not copied into the sudo context. For last command try:

$ sudo env PATH=$HOME/local/node/bin:$PATH make install