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.

  • 3
    apparently , it's not finding node or node lib in my path . i fixed it by creating a symlink ln -s /usr/bin/nodejs /usr/bin/node – Teja Reddy Apr 1 '15 at 10:37
  • Yeah, I've done that too. It's quite annoying that the binary is called nodejs while most of the stuff always assumes node. – user205301 Apr 1 '15 at 17:24

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
| improve this answer | |
  • yeah nodejs-legacy works too .. thanks – Teja Reddy Apr 1 '15 at 11:42
  • you deserve at least +1 :) – user284234 Apr 2 '15 at 6:50

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.


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.