3

I'm trying to install npm on ubuntu 11.04 using the "git all the way" method found in this gist

I keep getting this error after running sudo make install on npm

$ sudo make install
! [ -d .git ] || git submodule update --init --recursive
node cli.js install -g -f
bash: node: command not found
make: *** [install] Error 127

I know this is something wrong with bash, but I'm not very good with bash.

EDIT

running the node command in the terminal brings up the node shell as expected

4

5 回答 5

7

Your problem is that when you sudo, you are not sourcing the same bashrc file (or whatever is setting your PATH and/or NODE_PATH), and so the system cannot find node.

I would guess that sudo node won't work.

You need to export your NODE_PATH as @Ken suggested, WHILE SUDOING:

sudo PATH=/path/to/node/bin/dir:$PATH make install

EDIT: to use PATH as worked in comments below

于 2011-09-21T23:10:43.777 回答
1

Make sure you export NODE_PATH before installing npm.

export NODE_PATH=/path/to/node/install/dir:/path/to/node/install/dir/lib/node_modules
于 2011-09-21T23:03:31.103 回答
0

Looks like you don't have node installed. You need node first - then the node package manager (NPM).

于 2011-09-21T22:58:56.910 回答
0

This page illustrates the complete node installation including npm (step 4).

于 2011-09-21T23:00:55.490 回答
0

Like someone mentioned - why just use yum

sudo yum install nodejs npm --enablerepo=epel
于 2016-07-06T04:07:04.620 回答