I installed the NodeJS in Ubuntu 14.04 by nvm by following this site Installing NodeJS Though I had the following problem as

nvm ls
mkdir: cannot create directory ‘/usr/sbin/alias’: Permission denied

Then I found to resolve this as (from NVM solution)

$ export NVM_DIR=~/.nvm
$ echo $NVM_DIR

Then It works fine.

Now the problem, I face is that if I restart or even open a new console, I can't find the node again.

roy@Croy:~$ node -version
The program 'node' can be found in the following packages:

 * node

 * nodejs-legacy

Try: sudo apt-get install <selected package>

I have to follow those steps,

I do nvm install 0.11.13 then it shows

v0.11.13 is already installed.
Now using node v0.11.13

Here is my Stackoverflow question - the following answer is not working.

How to come out from here ?

  • try this link File ~/.profile is used for both desktop session and for textual session. – Lety Jul 23 '14 at 11:41
  • Reading the guide that you've followed, it seems that curl https://raw.githubusercontent.com/creationix/nvm/v0.7.0/install.sh | sh step went wrong. You can save your ~/.profile (make a copy in /tmp), redo this step and check what is new by diff /tmp/.profile ~/.profile – Lety Jul 23 '14 at 21:24

As seen here

  1. Run command:

    which node

    and in my case it displayed /usr/sbin/node.

  2. If it says command not found, skip to 3. Remove it by

    sudo rm /usr/sbin/node
  3. Run command:

    which nodejs

    In my case it displayed /usr/bin/nodejs

  4. Make a link

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


    sudo ln -s /usr/bin/nodejs /usr/sbin/node
  • 2
    This should be the answer. – Dominik Aug 28 '16 at 7:52

Run command:

nodejs -v

For more information: See here.


As seen here

Because of a conflict with another package, the executable from the Ubuntu repositories is called nodejs instead of node. Keep this in mind as you are running software.

user@xxx:~ $ node --version
The program 'node' can be found in the following packages:
* node
* nodejs-legacy
Ask your administrator to install one of them

user@xxx:~ $ nodejs --version

Node has a different name in the current version, mine is v0.10.25.

The current node is just nodejs.

To use the old commands you have to create a symbolic link like this.

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

and that's it.

Run: node --version

  • Suggestion: Regarding "the current version", it is better to note which version did you mean i.e. 0.10.25~dfsg2-2ubuntu1 for trusty release? – user37165 Feb 11 '16 at 16:44

The following line adds node to your $PATH:

nvm alias default 5.1

Use your installed node version.


How about using the official instructions from the nodejs site:

For v6:

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs

For v4:

curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs

I've tested these from Windows bash (via subsystem for Linux - 14.04) and it had the correct node alias. Running sudo apt-get install -y nodejs without first running the setup script will result in you getting node 0.10.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.