7

I installed node.js and npm recently and was trying to install the learnyounode npm package using sudo npm install -g learnyounode, but after installing I am not able to access it from command line. When I run learnyounode I am getting

/usr/bin/env: node: No such file or directory

I checked /usr/local/lib/node_modules to find learnyounode folder in it, not only learnyounode, I am not able to access any npm packages from command line. I am using npm 1.3.10 and node.js 0.10.25.

Jens Erat
  • 5,131
  • 7
  • 33
  • 37

2 Answers2

3

Try to install like this, then you don't need the sym link. If I were you I'd delete it, because you might not get the updates automatically and always have to "relink" it.

Try it like this:

aptitude install nodejs
apt-get install npm
aptitude install nodejs-legacy

Then try to install npm packages

npm install -g bunyan
npm install -g forever
s1mmel
  • 2,124
0

As mentioned in the comment section, create a link to fix the problem:

sudo ln -s /usr/bin/nodejs /usr/bin/node

Alternatively, as mentioned in this related post, you can also use update-alternatives to do the job:

sudo update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10

Either way, it should now work fine.

source

mchid
  • 44,904
  • 8
  • 102
  • 162