1
votes

I have installed Nodejs in Ubuntu 12 from source ( ./configure && make && sudo make install ) and all done successfully.

when i run

which node

/usr/local/bin/node

But when i run

node server.js

i got:

-bash: /usr/sbin/node: No such file or directory

I echo my path:

echo $PATH
/root/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/mysql/server-5.6/bin

/usr/local/bin is in the PATH.

I found Node.js not found. the same question. but i can not make it work by "sudo ln -s /usr/sbin/node /usr/local/bin/node" because "ln: failed to create symbolic link `/usr/local/bin/node': File exists"

2

2 Answers

4
votes

I used the terminal to manually copy node and nodejs from /usr/bin to /usr/sbin.

sudo cp /usr/bin/node /usr/bin/nodejs /usr/sbin/

Mine worked after this.

1
votes

I've checked it works at Ubuntu 16.04:

sudo apt-get install nodejs-legacy