n: Installed on Ubuntu 16.04.2 LTS, and `n ` doesn't change which node version I am using.

Issue Template:

Describe issue including what OS you are using

Ubuntu 16.04.2 LTS

Describe what version of N you have

2.1.7

Describe how you installed N

npm i -g n while on node v4.2.6 which is installed with default apt-get registry for my version of Ubuntu.

Steps to reproduce issue 1.2.3

npm i -g n
n latest
node -v

Describe the results you received

It outputs v4.2.6, but I was expecting v8.1.4

What version of npm you are using

5.0.3

Additional information you deem important (e.g. issue happens only occasionally):

> which n
/usr/local/bin/n
> node -v
v4.2.6

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 14
  • Comments: 19

Most upvoted comments

I seem to run into the same issue where n links the new version to /usr/local/bin/nodejs whereas my install has Node running from /usr/local/bin/node.

I’ve installed Node using the following:

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

For now fixing this using:

sudo n 8.4.0
sudo ln -sf /usr/local/n/versions/node/8.4.0/bin/node /usr/bin/node

Once linked, changing the version using n will automatically maintain the symlink correctly.

May actually be a duplicate of https://github.com/tj/n/issues/381 I’ve found that indeed after restarting the shell it did find the correct Node version.

Restarting shell didn’t work for me. It turned out that something (I’m guessing heroku toolbelt?) had added a new binary for me.

➜  ~ sudo n 6.7.0
➜  ~ node --version
v8.1.4
➜  ~ which -a node
/usr/local/heroku/bin/node
/usr/local/bin/node
/usr/bin/node
➜  ~ sudo ls -ltr /usr/local/heroku/bin 
total 33960
-rwxrwxr-x 1  500  500 34764936 Jul 11 03:10 node
-rw-r--r-- 1 root root      310 Jul 20 00:18 heroku.js
-rwxr-xr-x 1 root root      836 Jul 20 00:18 heroku
➜  ~ sudo rm /usr/local/heroku/bin/node 
➜  ~ node --version
v6.7.0

Removing that worked.

It might help to remove the pre-installed version of node sudo apt remove nodejs

export PATH=$PATH:/usr/local/bin/node

Restarting the shell was the most common fix.

This issue has not had any activity in over six months. It isn’t likely to get acted on due to this report.

Feel free to open a new issue if it comes up again, with new information and renewed interest.

Thank you for your contributions.

I had something similar:

$ which -a node
/usr/local/bin/node
/usr/bin/node
$ /usr/local/bin/node -v
v8.4.0
$ which node
/usr/local/bin/node
$ /usr/bin/node -v
v5.4.1
$ node -v
v5.4.1
$ rehash
$ node -v
v8.4.0

So I needed to rehash (or quit and re-run the shell) to fix this.

This was from doing the git clone version of install and then the foregoing n-based installs, all in one shell. Hard to think how to fix this, except perhaps by making ‘n’ check whether ‘which node’ changes value and printing a ***** BIG OBVIOUS WARNING ***** about it for stupid people like me. 😃

Here’s hoping I won’t suffer the npm install Buffer.alloc bug now.