Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I installed NodeJs on an Ubuntu machine, and the package have been installed as nodejs. Now, to run it as node, I created a symlink:

sudo ln -s /usr/bin/nodejs /usr/bin/node

This will work if I call the symlink directly, but it don't allow me to simply call node to start the program.

How can I resolve this?

share|improve this question
Some more investigation: Does nodejs work when running it as "nodejs" and what exactly is the error message you get when trying to run it as "node"? Another thing: You could take a look at nvm (Node Version Manager), it's good if you need a special version of node that is not provided by the package manager. – FSMaxB May 23 '13 at 16:07
@FSMaxB Running nodejs works as expected. But that's not enough as every other program rely on node being available as a command globally. Running node don't do anything - no error message. – Simon Boudrias May 23 '13 at 17:21
Maybe an alias in /etc/profile can help, but this won't work if node is run by the exec systemcall. What software are you using that depend on node? – FSMaxB May 23 '13 at 17:26
@FSMaxB I tried aliasing too, that was working in the command line, but wasn't working for executable declaring #!/usr/bin/env node. I have a lot of program running on node like Mocha unit test, Yeoman, Grunt, that I'd like to get running on Ubuntu. – Simon Boudrias May 23 '13 at 17:38
I don't really know much more to do other than trying a fresh install, but there's one idea that came to me right now: Not using a symlink but writing a bash script "/usr/bin/node" with "#!/bin/sh" and "/usr/bin/nodejs ......." inside (and somehow passing the parameters passed to the script on to nodejs, I'm not that good at bash programming) – FSMaxB May 23 '13 at 17:44
up vote 4 down vote accepted

Assuming you are asking about symlinking executables in general, this should automatically work out of the box. Make sure /usr/bin/nodejs is executable by everybody, and restart the terminal. In any case, calling node directly from anywhere in a terminal should work normally.

If node appears to execute properly but NodeJs itself does not like being called as node instead of nodejs, that's a different problem.

share|improve this answer
Hey, I just realized that typing the full path of the symlink works (e.g.: /usr/bin/node). But if I only type node it doesn't - do I have to set something in my PATH or in my terminal? – Simon Boudrias May 23 '13 at 3:20
@SimonBoudrias make sure your PATH variable contains "/usr/bin" you can check that by typing "env | grep PATH". It is however, very improbable that "/usr/bin" is not in your PATH variable, as your system shouldn't work properly if this was the case. – FSMaxB May 23 '13 at 15:58
@FSMaxB It is there... (if it helps, I'm running Ubuntu in a virtual machine via virtual box) – Simon Boudrias May 23 '13 at 16:03

There is a program "node" in Ubuntu, that has nothing to do with Node.js. Just uninstall it:

sudo apt-get remove node

(You would find the answer, if you tried whereis node.)

share|improve this answer
+1 Thanks! That did the trick for me. – gion_13 Dec 22 '13 at 10:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .