mac downgrade node version still show last version - node.js

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

Related

npm does not support Node.js v14.4.0

everyone.
I am upgrading Node.js and npm in my Ubuntu 18.04.6 server, but I'm running into a strange problem.
I was using the process as indicated in the installation guides:
To install Node.js version 17.2.0, I use
curl -fsSL https://deb.nodesource.com/setup_17.x | sudo -E bash -
sudo apt-get install -y nodejs
Then, to install npm version, I use
npm install -g npm
However, after this, when I try to use npm to install modules, I get the warning
npm does not support Node.js v14.4.0
You should probably upgrade to a newer version of node as we
can't make any promises that npm will work with this version.
Checking the versions of node, I find that
node --version
yields v14.4.0, but
nodejs --version
yields v17.2.0.
How do I fix it so node will point to the latest version and/or so npm will use the correct version of node?
I had also tried a lot for upgrading node version from 14 to 18. But even after installing latest version and following various procedures my version of node was showing 14.4.0 only.
Luckily following three node version manager commands solved my problem on my ubuntu machine v20.04.4:
1. curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
2. command -v nvm
3. nvm install node
Now check node has been updated to latest version and can be verified with node --version.
If you still find an old version even on installing new latest/lts version, then check which node version is set as default with following command:
nvm ls
you will see green colored version text set with an arrow in front of it. It will also show other versions which have installed recently like v16.15.0, v18.2.0, etc.
Change the node version you want to set by following command:
nvm alias default v18.2.0
After this close the terminal and restart the new terminal and try checking node JS version. Here you got you want..!!

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

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

Cannot upgrade Node version with the common commands

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

Resources