Cannot upgrade Node version with the common commands - node.js

I have trouble upgrading Node.js.
Currently, I have node --version "v0.8.18" and I would like to upgrade to the latest "v0.10.20". So I followed some answers that does not include NVM, since I want to know how to do it from scratch. However, after trying, I still get node --version "v0.8.18".
I am on an Ubuntu 11.04 machine, on my home directory.
Specifically I did:
Try 1:
alice#simba:~$ node --version
v0.8.18
alice#simba:~$ sudo n stable
sudo: n: command not found
alice#simba:~$ sudo npm install n -g
npm http GET https://registry.npmjs.org/n
npm http 200 https://registry.npmjs.org/n
npm http GET https://registry.npmjs.org/n/-/n-1.1.0.tgz
npm http 200 https://registry.npmjs.org/n/-/n-1.1.0.tgz
/usr/bin/n -> /usr/lib/node_modules/n/bin/n
n#1.1.0 /usr/lib/node_modules/n
alice#simba:~$ sudo n stable
install : 0.10.20
mkdir : /usr/local/n/versions/0.10.20
fetch : http://nodejs.org/dist/v0.10.20/node-v0.10.20-linux-x64.tar.gz
...
...#############/usr/bin/node
installed : v0.10.20
alice#simba:~$ node --version
v0.8.18
Try again:
alice#simba:~$ npm cache clean -f
alice#simba:~$ sudo npm install n -g
/usr/local/bin/n -> /usr/local/lib/node_modules/n/bin/n
n#1.1.0 /usr/local/lib/node_modules/n
alice#simba:~$ n stable
/usr/local/bin/node
alice#simba:~$ sudo n stable
/usr/local/bin/node
alice#simba:~$ node --version
v0.8.18

I use nvm myself, but something I've bumped up against in the past is that installing a version and selecting a version as active are different operations.
It may be that your new version is installed but not currently the default. Try:
n use 0.10.20

Related

I cannot switch node.js version

I am trying to switch my node.js version.
What I did is:
sudo npm cache clean -f
sudo npm install -g n
sudo n 10.10.0
But I check my current version after I did it by using
node -v
It always shows
v6.14.3
I am not sure if I do anything wrong. Any suggestion please?
As stated by Intervalia, try using using NVM (node version manager)
With nvm, you can very easily do things like:
nvm install 10.10.0 and it will download that version of node. And then do nvm use 10.10.0 and then doing node -v will return 10.10.0.
Here is what happens when I run nvm list

mac downgrade node version still show last version

Im trying to downgrade my node version so I run on terminal on mac
sudo npm cache clean -f
sudo npm install -g n
sudo n 9.10.0
then I try to check the version and it still as last version
npm -v
=> 5.6
node -v => v10.11.0
in addition when I run the commands above I get this errors
Maybe you can use https://github.com/creationix/nvm for get several versions in your PC

Node stuck at version 0.10.40

I'm trying to upgrade Node to v6.11.0 using the following instructions: https://www.abeautifulsite.net/how-to-upgrade-or-downgrade-nodejs-using-npm
I've used:
sudo npm cache clean -f
sudo npm install -g n
sudo n 6.11.0
which resulted in:
install : node-v6.11.0
mkdir : /usr/local/n/versions/node/6.11.0
fetch : https://nodejs.org/dist/v6.11.0/node-v6.11.0-darwin-x64.tar.gz
######################################################################## 100.0%
installed : v0.10.40
It looks like I can't install a version of node greater than v0.10.40. The main reason why I'm trying to upgrade is that I'm receiving a error ('SyntaxError: Use of const in strict mode.') as seen here: https://github.com/Shopify/slate/issues/317

Install nodejs 4.2.0 or above version

I have installed node and npm using following command in my Ubuntu machine:
sudo apt-get install nodejs npm
On checking version of installed, I could see following:
$ node -v && npm -v
v0.10.25
1.3.10
But I want nodejs version to be 4.2.0 or above. I am trying to install VSO Linux agent for a project. On executing node agent/vsoagent, I get error that node version should be 4.2.0 or above.
How do I install it and also make sure that the already installed ones are removed with node -v && npm -v gives me new version number?
Thanks
You already have npm, so you can use n manager to install any version you want (4.4.4 for ex): maybe you should use sudo for global install:
npm install -g n
n 4.4.4
Or
n latest
After that you can just run n to select version that you prefer. I use latest LTS and latest 6.x side-by-side and switching them anytime i want.

getting error in ionic serve in Terminal after updating nodejs

I am using ubuntu 15.10
ionic version 1.7.15.
I was trying to update my nodejs to laters version 6 and npm and after that when i run ionic server command i am getting error shown in
the command i used to update
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
how to to downgrade my nodejs
when i use whereis node command
node: /usr/local/bin/node /opt/node/bin/node
when i use whereis nodejs command
nodejs:
when i use whereis npm command
npm: /usr/local/bin/npm /opt/node/bin/npm
I think i have to use lower version of node but i dont know how to do is i have tried my cmd but no use
I solved this issue by mention the version of node
sudo npm cache clean -f
sudo npm install -g n
sudo n v4.2.3 //By mentioning the version while i install i solved this error on serve
i switched my node version from v6 to v4 so then i got no error

Resources