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
share|improve this question
    
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 – JP Ventura Mar 15 '14 at 19:17
up vote 41 down vote accepted

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
share|improve this answer
3  
+1, symlink works great. – Click Upvote Nov 13 '14 at 4:27
    
The symlink solution works fine in case you used a package manager to install it – U7786 Jul 29 '17 at 9:27

The next command helps:

ln -s /usr/bin/nodejs /usr/bin/node
share|improve this answer
    
Worked. Thank you – Elimination Dec 18 '15 at 11:21

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).

share|improve this answer

In your terminal run the following:

sudo apt-get update

sudo apt-get install nodejs

sudo apt-get install npm
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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