Reputation: 2821
I'm trying to update Node.js on Ubuntu serever 14.04 using n
.
n
upgrades but the version is still the same:
root@0e2dbaa3db85:/home# node -v
v0.10.25
root@0e2dbaa3db85:/home# n 0.10.33
install : node-v0.10.33
mkdir : /usr/local/n/versions/node/0.10.33
fetch : https://nodejs.org/dist/v0.10.33/node-v0.10.33-linux-x64.tar.gz
installed : v0.10.33
root@0e2dbaa3db85:/home# node -v
v0.10.25
Do I have to tell n
which version to use as default?
I've tried n latest
, it installs 0.12.0 but node -v
outputs 0.10.25
again.
What should I do?
Upvotes: 3
Views: 10948
Reputation: 1582
I faced a similar issue, caused by Homebrew. I did not install Node by Homebrew by choise, but I had recently installed a MongoDB-package through Homebrew (mongodb-community
). Node is aparently bundled with that package 😉.
Solution: Uninstall Node through Homebrew, letting the 'n' software do the job!
$ brew uninstall --ignore-dependencies node
$ sudo n 18
(Replace the number 18 with whatever specific version you need to target)
$ node -v
v18.20.5
Upvotes: 0
Reputation: 352
For me, I had the active version set via Homebrew, so n wasn't overriding it.
I had to use the following:
brew uninstall node && sudo n stable
Upvotes: 0
Reputation: 327
I faced same issue, where I select a different version or even download a new version with n and it still shows the initial installation before I started using n. This worked for me:
Unlink
sudo unlink /usr/bin/node
Run n again to choose the node version. After this two steps it worked
Upvotes: 2
Reputation: 499
Try to set the simbolic link to node to the npm global folder.
in my case, my path to npm-global dir was on my home. So the full path was /home/rafael/.npm-global/node/bin/node
After this, check if is allrigth:
Enjoy
Upvotes: 0
Reputation: 855
nvm
.n
because I installed nvm
and used nvm
to manage node versions before.nvm
command. For example: nvm install 11.8.0
then check node version node -v
. Tada it works.Upvotes: 8
Reputation: 11838
On occasion the n package won't install the links for node, and the selection won't allow you to select any version installed by n.
When that happens, you need to install an "n" version of node so the selector will allow you to choose.
Here is what I had to do.
Use n to install a node version.
# n stable
install : node-v5.10.1
mkdir : /usr/local/n/versions/node/5.10.1
fetch : https://nodejs.org/dist/v5.10.1/node-v5.10.1-linux-x64.tar.gz
######################################################################## 100.0%
installed : v0.10.42
Select the node version from the install directory
In this case it is located at:
/usr/local/n/versions/node/5.10.1/bin/node
Replace existing node link with new node version
cd /bin
mv node node_old
ln -s /usr/local/n/versions/node/5.10.1/bin/node
At this point node should work, and n should allow you to select version.
Upvotes: 10
Reputation: 41440
From what I can read from the n readme, you need to call n <version>
to install, and then run n
with no arguments, so a version picker will be shown:
Type n to prompt selection of an installed node. Use the up / down arrow to navigate, and press enter or the right arrow to select, or ^C to cancel:
(...)
Commands: n <version> Install node <version>
However, if you run n latest
, it will install or activate the latest version:
n latest Install or activate the latest node release
Upvotes: 0
Reputation: 21748
n 0.10.33
will install that version of node, but you still haven't selected it. After installing, simply execute n
and pick the version you want to use.
n latest
will install or activate the latest version of node. Run it twice to use node 0.12.0
Upvotes: 2