This repository has been archived by the owner. It is now read-only.

run npm command gives error "/usr/bin/env: node: No such file or directory" #3911

Closed
nickgit opened this Issue Aug 23, 2012 · 117 comments

Comments

Projects
None yet
@nickgit

nickgit commented Aug 23, 2012

This happens in version 0.6.x on ubuntu. Does not happen above 0.7.x

@bnoordhuis

This comment has been minimized.

Show comment
Hide comment
@bnoordhuis

bnoordhuis Aug 23, 2012

Member

Not a node bug. The node binary is not on your $PATH.

Member

bnoordhuis commented Aug 23, 2012

Not a node bug. The node binary is not on your $PATH.

@bnoordhuis bnoordhuis closed this Aug 23, 2012

@digitalmediums

This comment has been minimized.

Show comment
Hide comment
@digitalmediums

digitalmediums Sep 27, 2012

I've found this is often a misnaming error, if you install from a package manager you bin may be called nodejs so you just need to symlink it like so "ln -s /usr/bin/nodejs /usr/bin/node"

digitalmediums commented Sep 27, 2012

I've found this is often a misnaming error, if you install from a package manager you bin may be called nodejs so you just need to symlink it like so "ln -s /usr/bin/nodejs /usr/bin/node"

@mtrovo

This comment has been minimized.

Show comment
Hide comment
@mtrovo

mtrovo Jan 17, 2013

digitalmediums,
That was useful, thanks a lot!

mtrovo commented Jan 17, 2013

digitalmediums,
That was useful, thanks a lot!

@houmie

This comment has been minimized.

Show comment
Hide comment
@houmie

houmie Jan 28, 2013

After 3 hours of suffering, this is the solution. Thank you digitalmediums. Why is this now misnaming happening now out of the blue?

houmie commented Jan 28, 2013

After 3 hours of suffering, this is the solution. Thank you digitalmediums. Why is this now misnaming happening now out of the blue?

@othiym23

This comment has been minimized.

Show comment
Hide comment
@othiym23

othiym23 Jan 28, 2013

@houmie (and everyone who comes across this bug in the future)

These explain why:

http://lists.debian.org/debian-devel-announce/2012/07/msg00002.html
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=614907
http://debian.2.n7.nabble.com/Node-js-and-it-s-future-in-debian-td1042211.html (only read this last thread if you're a masochist)

As a Node developer, I would think hard before using Debian's packaged version of node, and would use Ubuntu with chrislea's PPA for Node or Debian stable with Node built from source in preference to the stock Debian nodejs package for the foreseeable future. The discussion on this bug makes clear that Debian has a very different idea of the role of Node in the wider world than most of the Node community.

othiym23 commented Jan 28, 2013

@houmie (and everyone who comes across this bug in the future)

These explain why:

http://lists.debian.org/debian-devel-announce/2012/07/msg00002.html
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=614907
http://debian.2.n7.nabble.com/Node-js-and-it-s-future-in-debian-td1042211.html (only read this last thread if you're a masochist)

As a Node developer, I would think hard before using Debian's packaged version of node, and would use Ubuntu with chrislea's PPA for Node or Debian stable with Node built from source in preference to the stock Debian nodejs package for the foreseeable future. The discussion on this bug makes clear that Debian has a very different idea of the role of Node in the wider world than most of the Node community.

@houmie

This comment has been minimized.

Show comment
Hide comment
@houmie

houmie Jan 29, 2013

@othiym23 Thank you for the explanation. :) I see there is a proper flame war around this. But its understandable when namespaces are broken. Hope they can resolve it at one stage.

houmie commented Jan 29, 2013

@othiym23 Thank you for the explanation. :) I see there is a proper flame war around this. But its understandable when namespaces are broken. Hope they can resolve it at one stage.

@micfan

This comment has been minimized.

Show comment
Hide comment

micfan commented Mar 5, 2013

@Augustin82

This comment has been minimized.

Show comment
Hide comment
@Augustin82

Augustin82 Mar 6, 2013

Thanks for the help.

Augustin82 commented Mar 6, 2013

Thanks for the help.

@JohnArcher

This comment has been minimized.

Show comment
Hide comment

JohnArcher commented Mar 15, 2013

@digitalmediums Thanks!

@johnjbarton

This comment has been minimized.

Show comment
Hide comment
@johnjbarton

johnjbarton Apr 12, 2013

I installed via sudo make install.

npm still fails:

/work/qpp$ sudo npm install -g grunt-cli
/usr/bin/env: node: No such file or directory
/work/qpp$ node -v
v0.10.4
/work/qpp$ which node
/usr/local/bin/node

johnjbarton commented Apr 12, 2013

I installed via sudo make install.

npm still fails:

/work/qpp$ sudo npm install -g grunt-cli
/usr/bin/env: node: No such file or directory
/work/qpp$ node -v
v0.10.4
/work/qpp$ which node
/usr/local/bin/node

@bnoordhuis

This comment has been minimized.

Show comment
Hide comment
@bnoordhuis

bnoordhuis Apr 12, 2013

Member

@johnjbarton Try sudo PATH="$PATH:/usr/local/bin" npm install -g grunt-cli

Member

bnoordhuis commented Apr 12, 2013

@johnjbarton Try sudo PATH="$PATH:/usr/local/bin" npm install -g grunt-cli

@johnjbarton

This comment has been minimized.

Show comment
Hide comment
@johnjbarton

johnjbarton Apr 12, 2013

Thanks. However in the meantime I uninstalled node, unintalled npm, then
installed node and installed npm. Then I was able to install grunt-cli.

On Fri, Apr 12, 2013 at 2:13 PM, Ben Noordhuis notifications@github.comwrote:

@johnjbarton https://github.com/johnjbarton Try sudo
PATH="$PATH:/usr/local/bin" npm install -g grunt-cli


Reply to this email directly or view it on GitHubhttps://github.com/joyent/node/issues/3911#issuecomment-16317844
.

johnjbarton commented Apr 12, 2013

Thanks. However in the meantime I uninstalled node, unintalled npm, then
installed node and installed npm. Then I was able to install grunt-cli.

On Fri, Apr 12, 2013 at 2:13 PM, Ben Noordhuis notifications@github.comwrote:

@johnjbarton https://github.com/johnjbarton Try sudo
PATH="$PATH:/usr/local/bin" npm install -g grunt-cli


Reply to this email directly or view it on GitHubhttps://github.com/joyent/node/issues/3911#issuecomment-16317844
.

@arky

This comment has been minimized.

Show comment
Hide comment
@arky

arky Jun 5, 2013

Just do

$ sudo apt-get install nodejs-legacy

https://github.com/volojs/volo#install

arky commented Jun 5, 2013

Just do

$ sudo apt-get install nodejs-legacy

https://github.com/volojs/volo#install

@gw0

This comment has been minimized.

Show comment
Hide comment
@gw0

gw0 Jun 8, 2013

Yes, installing nodejs-legacy is the cleanest solution.

Imho trying to name a server with a generic word like node is pretty stupid and it is quite understandable that there is so much resistance in accepting such a name. Rename it back to something unique that is easy to google for and can not be mistaken for something else, like nodejs, and everyone will be happy.

gw0 commented Jun 8, 2013

Yes, installing nodejs-legacy is the cleanest solution.

Imho trying to name a server with a generic word like node is pretty stupid and it is quite understandable that there is so much resistance in accepting such a name. Rename it back to something unique that is easy to google for and can not be mistaken for something else, like nodejs, and everyone will be happy.

@bnoordhuis

This comment has been minimized.

Show comment
Hide comment
@bnoordhuis

bnoordhuis Jun 8, 2013

Member

For very restricted definitions of 'everyone'. You're only two or three years late - that ship has long sailed.

Member

bnoordhuis commented Jun 8, 2013

For very restricted definitions of 'everyone'. You're only two or three years late - that ship has long sailed.

@ForbesLindesay

This comment has been minimized.

Show comment
Hide comment
@ForbesLindesay

ForbesLindesay Jun 8, 2013

That ship sailed a long time ago and those arguments only really apply to something that's not vastly popular. node.js is popular enough to claim the node name and expect other less popular programs not to conflict with it.

As for not being googlable: https://www.google.com/?q=node

ForbesLindesay commented Jun 8, 2013

That ship sailed a long time ago and those arguments only really apply to something that's not vastly popular. node.js is popular enough to claim the node name and expect other less popular programs not to conflict with it.

As for not being googlable: https://www.google.com/?q=node

@amitmnnit

This comment has been minimized.

Show comment
Hide comment
@amitmnnit

amitmnnit commented Sep 3, 2013

Thanks,

@jarl-dk

This comment has been minimized.

Show comment
Hide comment
@jarl-dk

jarl-dk Dec 2, 2013

@othiym23 : Thanks for the details on ubuntu/debian...

jarl-dk commented Dec 2, 2013

@othiym23 : Thanks for the details on ubuntu/debian...

@ebuildy

This comment has been minimized.

Show comment
Hide comment
@ebuildy

ebuildy Dec 3, 2013

I had to append /usr/bin to PATH in my PHP code :

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

ebuildy commented Dec 3, 2013

I had to append /usr/bin to PATH in my PHP code :

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

@kevbob1

This comment has been minimized.

Show comment
Hide comment
@kevbob1

kevbob1 Dec 23, 2013

"update-alternatives --install /usr/bin/node node /usr/bin/nodejs 99"

this fixed it for me

kevbob1 commented Dec 23, 2013

"update-alternatives --install /usr/bin/node node /usr/bin/nodejs 99"

this fixed it for me

@rlidwka

This comment has been minimized.

Show comment
Hide comment
@rlidwka

rlidwka Dec 24, 2013

or just apt-get install nodejs-legacy

rlidwka commented Dec 24, 2013

or just apt-get install nodejs-legacy

@rafee

This comment has been minimized.

Show comment
Hide comment
@rafee

rafee Jan 5, 2014

rlidwka's solution is the one, I arrived. Except the fact, I didn't see it & gone through infinite suffering.

rafee commented Jan 5, 2014

rlidwka's solution is the one, I arrived. Except the fact, I didn't see it & gone through infinite suffering.

@rlidwka

This comment has been minimized.

Show comment
Hide comment
@rlidwka

rlidwka Jan 5, 2014

rlidwka's solution is the one, I arrived. Except the fact, I didn't see it & gone through infinite suffering.

you sound like Zathras :)

rlidwka commented Jan 5, 2014

rlidwka's solution is the one, I arrived. Except the fact, I didn't see it & gone through infinite suffering.

you sound like Zathras :)

@jadedgnome

This comment has been minimized.

Show comment
Hide comment
@jadedgnome

jadedgnome Mar 14, 2014

i did :$ ln -s /usr/bin/nodejs /usr/bin/node

jadedgnome commented Mar 14, 2014

i did :$ ln -s /usr/bin/nodejs /usr/bin/node

@rzr

This comment has been minimized.

Show comment
Hide comment
@rzr

rzr Mar 22, 2014

sudo ln -fs /usr/bin/nodejs /usr/local/bin/node

rzr commented Mar 22, 2014

sudo ln -fs /usr/bin/nodejs /usr/local/bin/node

@rdecicco

This comment has been minimized.

Show comment
Hide comment
@rdecicco

rdecicco Apr 8, 2014

Thank you @digitalmediums. It works

rdecicco commented Apr 8, 2014

Thank you @digitalmediums. It works

@acutexyz

This comment has been minimized.

Show comment
Hide comment

acutexyz commented Apr 26, 2014

@anthonykeane

This comment has been minimized.

Show comment
Hide comment

anthonykeane commented Apr 30, 2014

@alwinlin23

This comment has been minimized.

Show comment
Hide comment

alwinlin23 commented May 2, 2014

thanks @digitalmediums !

@samv

This comment has been minimized.

Show comment
Hide comment
@samv

samv May 19, 2014

The chutzpah of claiming the right to 'node' in the path is short-sighted; this issue also crops up if you want multiple versions of an interpreter running in the same system. The simple way around this bug is if 'npm install' looks at the name of the interpreter that is running it, and writes that to the #!/usr/bin/env FOO line.

samv commented May 19, 2014

The chutzpah of claiming the right to 'node' in the path is short-sighted; this issue also crops up if you want multiple versions of an interpreter running in the same system. The simple way around this bug is if 'npm install' looks at the name of the interpreter that is running it, and writes that to the #!/usr/bin/env FOO line.

@dzona

This comment has been minimized.

Show comment
Hide comment
@dzona

dzona commented Jun 1, 2014

@digitalmediums Thanks man 👍

@ShinDarth

This comment has been minimized.

Show comment
Hide comment
@ShinDarth

ShinDarth Jun 8, 2014

Same problem here, using Ubuntu 14.04.

Solved thanks to @digitalmediums

ShinDarth commented Jun 8, 2014

Same problem here, using Ubuntu 14.04.

Solved thanks to @digitalmediums

@neoplomero

This comment has been minimized.

Show comment
Hide comment
@neoplomero

neoplomero Jun 10, 2014

"@digitalmediums SNOW" YOU KNOW NOTHING !!!

neoplomero commented Jun 10, 2014

"@digitalmediums SNOW" YOU KNOW NOTHING !!!

@dminca

This comment has been minimized.

Show comment
Hide comment
@dminca

dminca Sep 13, 2015

sudo apt-get install nodejs-legacy fixed it for me 👍

dminca commented Sep 13, 2015

sudo apt-get install nodejs-legacy fixed it for me 👍

@rvagg

This comment has been minimized.

Show comment
Hide comment
@rvagg

rvagg Sep 14, 2015

Member

the best way to avoid this would be to just go for the NodeSource Node distribution to avoid this whole nodejs vs node naming garbage kicked up by Debian. https://github.com/nodesource/distributions

Note that newer versions are not available (yet) for older Linuxes, there are toolchain issues that make that difficult, but v0.10 and v0.12 should be available for all if that's all you need.

Member

rvagg commented Sep 14, 2015

the best way to avoid this would be to just go for the NodeSource Node distribution to avoid this whole nodejs vs node naming garbage kicked up by Debian. https://github.com/nodesource/distributions

Note that newer versions are not available (yet) for older Linuxes, there are toolchain issues that make that difficult, but v0.10 and v0.12 should be available for all if that's all you need.

@Glideh

This comment has been minimized.

Show comment
Hide comment
@Glideh

Glideh Sep 19, 2015

@digitalmediums thanks

$ sudo ln -fs /usr/bin/nodejs /usr/local/bin/node

Glideh commented Sep 19, 2015

@digitalmediums thanks

$ sudo ln -fs /usr/bin/nodejs /usr/local/bin/node
@bdunn

This comment has been minimized.

Show comment
Hide comment
@bdunn

bdunn commented Sep 30, 2015

thanks!

@terencemutizwa

This comment has been minimized.

Show comment
Hide comment
@terencemutizwa

terencemutizwa Oct 5, 2015

thanks a lot for this

terencemutizwa commented Oct 5, 2015

thanks a lot for this

@vishivish18

This comment has been minimized.

Show comment
Hide comment
@vishivish18

vishivish18 Oct 11, 2015

It helped, thanks a lot.

vishivish18 commented Oct 11, 2015

It helped, thanks a lot.

@eiger3970

This comment has been minimized.

Show comment
Hide comment
@eiger3970

eiger3970 Oct 14, 2015

Yes, digitalmediums' answer fixed it.
"ln -s /usr/bin/nodejs /usr/bin/node"
Muchos gracias 👍

eiger3970 commented Oct 14, 2015

Yes, digitalmediums' answer fixed it.
"ln -s /usr/bin/nodejs /usr/bin/node"
Muchos gracias 👍

@romeromfm

This comment has been minimized.

Show comment
Hide comment
@romeromfm

romeromfm Oct 20, 2015

digitalmediums,
That was useful, thanks a lot!

romeromfm commented Oct 20, 2015

digitalmediums,
That was useful, thanks a lot!

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Oct 25, 2015

Thank you, it worked for me!

ghost commented Oct 25, 2015

Thank you, it worked for me!

@flocko flocko referenced this issue Nov 13, 2015

Closed

node is missing #1

@dunnleaddress

This comment has been minimized.

Show comment
Hide comment
@dunnleaddress

dunnleaddress Nov 17, 2015

@digitalmediums you are right till now. thank you!
"if you install from a package manager you bin may be called nodejs so you just need to symlink it like so "ln -s /usr/bin/nodejs /usr/bin/node""

dunnleaddress commented Nov 17, 2015

@digitalmediums you are right till now. thank you!
"if you install from a package manager you bin may be called nodejs so you just need to symlink it like so "ln -s /usr/bin/nodejs /usr/bin/node""

@chrissilkey

This comment has been minimized.

Show comment
Hide comment
@chrissilkey

chrissilkey Nov 29, 2015

Great!, thanks for the post

chrissilkey commented Nov 29, 2015

Great!, thanks for the post

@mattbrosenberg

This comment has been minimized.

Show comment
Hide comment
@mattbrosenberg

mattbrosenberg Dec 1, 2015

Symlink worked great for Debian deploy, thanks!

mattbrosenberg commented Dec 1, 2015

Symlink worked great for Debian deploy, thanks!

@CruiseDevice

This comment has been minimized.

Show comment
Hide comment
@CruiseDevice

CruiseDevice Dec 18, 2015

sudo apt-get install nodejs-legacy
worked :) 👍

CruiseDevice commented Dec 18, 2015

sudo apt-get install nodejs-legacy
worked :) 👍

@leemke

This comment has been minimized.

Show comment
Hide comment
@leemke

leemke Jan 21, 2016

sudo apt-get install nodejs-legacy worked :)

leemke commented Jan 21, 2016

sudo apt-get install nodejs-legacy worked :)

@fgesora

This comment has been minimized.

Show comment
Hide comment
@fgesora

fgesora Jan 26, 2016

Some Linux distributions installs NodeJS as nodejs and not node. Simply create a link as
ln -s /usr/bin/nodejs /usr/bin/node

fgesora commented Jan 26, 2016

Some Linux distributions installs NodeJS as nodejs and not node. Simply create a link as
ln -s /usr/bin/nodejs /usr/bin/node

@iranalves85

This comment has been minimized.

Show comment
Hide comment
@iranalves85

iranalves85 Jan 27, 2016

thanks, my npm is working now.

iranalves85 commented Jan 27, 2016

thanks, my npm is working now.

@theblackhole

This comment has been minimized.

Show comment
Hide comment
@theblackhole

theblackhole Jan 28, 2016

@fgesora 's solution works for me, thanks 👍 (I use nvm)

theblackhole commented Jan 28, 2016

@fgesora 's solution works for me, thanks 👍 (I use nvm)

@thfontaine

This comment has been minimized.

Show comment
Hide comment
@thfontaine

thfontaine Jan 28, 2016

Thanks, worked for me =)

thfontaine commented Jan 28, 2016

Thanks, worked for me =)

@alexanderbezverhni

This comment has been minimized.

Show comment
Hide comment

alexanderbezverhni commented Mar 11, 2016

@aeolusheath

This comment has been minimized.

Show comment
Hide comment

aeolusheath commented Mar 17, 2016

@wellington1993

This comment has been minimized.

Show comment
Hide comment

wellington1993 commented Apr 14, 2016

@matheushf

This comment has been minimized.

Show comment
Hide comment
@matheushf

matheushf commented Apr 21, 2016

dude, thanks! @digitalmediums

@iamtodor

This comment has been minimized.

Show comment
Hide comment
@iamtodor

iamtodor Apr 21, 2016

@digitalmediums you are the great guy! This shitty issue still happens almost 4 yeah later.. (:

iamtodor commented Apr 21, 2016

@digitalmediums you are the great guy! This shitty issue still happens almost 4 yeah later.. (:

@arachchi

This comment has been minimized.

Show comment
Hide comment
@arachchi

arachchi Apr 26, 2016

thanks for the help

arachchi commented Apr 26, 2016

thanks for the help

@apocora

This comment has been minimized.

Show comment
Hide comment
@apocora

apocora May 4, 2016

I expected them to fix it after 3 years....

apocora commented May 4, 2016

I expected them to fix it after 3 years....

@rpulijala

This comment has been minimized.

Show comment
Hide comment
@rpulijala

rpulijala May 5, 2016

Wow, this issue has been since last 4 years... well thats interesting

rpulijala commented May 5, 2016

Wow, this issue has been since last 4 years... well thats interesting

@Li-ReDBox

This comment has been minimized.

Show comment
Hide comment
@Li-ReDBox

Li-ReDBox May 11, 2016

I found this amazing and shocking. Really lack of caring.

Li-ReDBox commented May 11, 2016

I found this amazing and shocking. Really lack of caring.

@bnoordhuis

This comment has been minimized.

Show comment
Hide comment
@bnoordhuis

bnoordhuis May 11, 2016

Member

For people coming here through search engines, the correct solution is #3911 (comment) or #3911 (comment).

To the last three commenters: If you are unhappy that Debian decided to call the binary nodejs instead of node, complain to Debian. Griping about it here won't help.

Locking.

Member

bnoordhuis commented May 11, 2016

For people coming here through search engines, the correct solution is #3911 (comment) or #3911 (comment).

To the last three commenters: If you are unhappy that Debian decided to call the binary nodejs instead of node, complain to Debian. Griping about it here won't help.

Locking.

@nodejs nodejs locked and limited conversation to collaborators May 11, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.