Node.js – node no such file or directory

node.jsubuntu-12.04

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"

Best Solution

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.