20

I installed Cordova and PhoneGap with npm:

sudo npm install -g cordova
sudo npm install -g phonegap

however, both return the same error message:

/usr/bin/env: node: No such file or directory
JP Ventura
  • 5,564
  • 6
  • 52
  • 69
  • Both files are using node instead of nodejs as interpreted. The fix can be found at post [Sencha PhoneGap Init failed on Ubuntu 13.10](http://stackoverflow.com/questions/22272569/sencha-phonegap-init-failed-on-ubuntu-13-10) – JP Ventura Mar 15 '14 at 19:17

4 Answers4

41

it's not finding node or node lib on your path

There different solutions posted here:

https://github.com/joyent/node/issues/3911

A few: PATH:

appending /usr/local/bin:/usr/bin

putenv('PATH=' . getenv('PATH') . ':/usr/local/bin:/usr/bin');

Symlink:

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

Installing node legacy:

apt-get install nodejs-legacy
Tamil Selvan C
  • 19,913
  • 12
  • 49
  • 70
csantanapr
  • 5,002
  • 2
  • 19
  • 15
25

The next command helps:

ln -s /usr/bin/nodejs /usr/bin/node
Nikos
  • 3,267
  • 1
  • 25
  • 32
clark
  • 251
  • 3
  • 3
4

Create a shortcut in /usr/local (not /usr/bin):

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

According to The Linux Documentation Project, distributions may not install anything in there. It is reserved solely for the use of the local administrator.

This way he/she can be absolutely certain that no updates or upgrades to his distribution will overwrite any extra software he has installed locally.

If you are a full-stack developer requiring later features, I recommend installing the latest Node.JS according Ask Ubuntu instructions.

Remember that Ubuntu 14.04.5 LTS provides Node.JS v0.10.25 (stable).

Community
  • 1
  • 1
JP Ventura
  • 5,564
  • 6
  • 52
  • 69
0

In your terminal run the following:

sudo apt-get update

sudo apt-get install nodejs

sudo apt-get install npm
Tobi Nary
  • 4,566
  • 4
  • 30
  • 50