Node.js – node no such file or directory


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

when i run

which 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

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