Can't switch to another version of Node - node.js

I can't switch any more to another of Node versions I Installed via NVM.
So far I did it by using these commands:
nvm list //to check Node versions available on my machine
nvm use X.X.X //to pick a version
node -v //to check if I'm using the Node version I picked
Now If I run those commands I see that the current node version is always 14.17.0. This is what Visual Studio Code terminal shows me:
$ nvm list
14.0.0
12.11.0
12.2.0
12.0.0
11.11.0
10.24.1
8.16.2
$ nvm use 12.0.0
Now using node v12.0.0 (64-bit)
$ node -v
v14.17.0

Related

node version manager not changing the Node Version in Ubuntu. Stuck on system node version. How to change node version using nvm?

I am trying to do
npm install wrtc
with node version 16.14.0
but that's not getting done. It's giving
npm error code 1
So I was trying to change node version to previous lts which was 14.19.0 but it's not getting changed
I did...
node -v
nvm list
nvm use 14.19.0 => output - ***Now using node v14.19.0 (npm v8.5.3)***
node -v (version not changed... Still 16.14.0
nvm list - shows the arrow mark '->' still on system
Are you following these steps?
Please make sure that your npm version is correctly installed according to your node version.

How do I change my Node version after installing it using Homebrew?

After installing Node using Homebrew on OSX 10.11.6 I now have a copy of node installed at
/usr/local/Cellar/node/10.7.0.
However, the version of Node that appears when I run
$ node -v
in terminal is
v0.12.7
I would like OSX terminal to reference the v10.07 of Node I just installed via Homebrew when I type
$ node
How do I change which node version that OSX terminal recognizes?
You should try using NVM. It allows you to install multiple versions of Node on your machine and switch between them conveniently:
see NVM docs

npm not work in windows 7

I install the nodejs its work wihtout any problem but when I try to install some packge with the npm.
The npm not work and give me this problem:
error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\node_modules\npm\bin\npm-cli.js'
This the varaible system path:
The floder C:\Users\xxxxx\AppData\Roaming\npm is empty.
I dont now what is the problem why not work?
npm usually comes shipped with Node. Setup issues are very common while working with Node. I think it will be faster for You to do a clean reinstall than try to fix Your issue.
What I found working the best for me is using nvm. It's a command line tool which lets You install any version of Node and switch to any other version at any time.
You are on Windows 7, so what You are interested in is nvm-setup.zip from this source:
https://github.com/coreybutler/nvm-windows/releases
Run the setup and if it asks You about controlling versions press yes.
Now, run Your cmd.
Administrator#MECH-PC D:\a
$ nvm list
* 6.8.1 (Currently using 64-bit executable)
5.0.0
4.0.0
0.10.38
Administrator#MECH-PC D:\a
$ node -v
v6.8.1
Administrator#MECH-PC D:\a
$ npm -v
3.10.8
Administrator#MECH-PC D:\a
$ nvm install 5
5.0.0
Downloading node.js version 5.0.0 (64-bit)... Complete
Creating C:\Users\Administrator\AppData\Roaming\nvm\temp
Downloading npm version 3.3.6... Complete
Installing npm v3.3.6...
Installation complete. If you want to use this version, type
nvm use 5.0.0
Administrator#MECH-PC D:\a
$ nvm use 5
5.0.0
Now using node v5.0.0 (64-bit)
Administrator#MECH-PC D:\a
$ nvm list
6.8.1
* 5.0.0 (Currently using 64-bit executable)
4.0.0
0.10.38
Administrator#MECH-PC D:\a
$ node -v
v5.0.0
Administrator#MECH-PC D:\a
$ npm -v
3.3.6
Note
On Windows nvm use will persist selected version. In unix You need nvm alias default [VERSION] e.g. nvm alias default 6.8.1
Additional reading for unix guys:
http://www.nearform.com/nodecrunch/nodejs-sudo-free/
#Kamil Mech
I install tje nvm dna work but howa can I in integrate with nodejs ???
oooh I dont now where is the porblem but the npm now work

How can I use nvm to manage multiple locally installed node.js?

I already have multiple node.js versions installed locally in my x-Linux box,
0.10.40, 0.12.7 and 4.0
My default profile is pointing to node.js 0.12.7
Currently, I set my PATH to point to different versions of node when I start a new terminal.
I would like to use node version manager to use and manage different version of node that is already installed in my environment .
How should I do it without reinstalling node again?
Answering Original Post
For the small amount of data that you'd save by doing the following, it's almost not worth it. That being said...
Find where current versions are stored in nvm:
> nvm which
# mac
/Users/[username]/.nvm/versions/node/[version]/bin/node
# linux
/home/[username]/.nvm/versions/node/[version]/bin/node
Find all your non-nvm installed versions of node:
> which -a node
(..pending how you are running each of your terminals for each version of node installed will tell how effective this command will be).
Then symbolic link each of them to a folder matching the version.
> ln -s /path/to/node/version ~/.nvm/versions/node/[version]
# `$HOME` or `~/` or `/Home/username/` ... you know which works.
Node and Version Swapping Made Simple
nvm-controlled versions of node installed
> nvm ls
v0.10.33
v0.10.36
v0.10.40
v4.0.0
v4.2.2
v5.0.0
-> v5.1.1
system
default -> v5.1.1
system -> v5.1.1
node -> stable (-> v5.1.1) (default)
stable -> 5.1 (-> v5.1.1) (default)
iojs -> N/A (default)
Install version x, x.y, or x.y.z: nvm install x.y.z.
ie:
> nvm install 4.2.2
# If you want all modules from another version too:
> nvm install 4.2.2 --reinstall-packages-from=0.10.40
Set the default version used:
> nvm use 5.1.1
# But if only a local node command required, use:
# nvm exec [version] [command]
> nvm exec 0.10.33 node server.js
.nvmrc file in project root to define which local version of node to use.
#.nvmrc file contents:
5.1.1
You can't using installed nodejs version with nvm,
Because nvm use own directory for managing versions
You just need reinstall node versions
nvm install 0.12.7
And then
nvm use 0.12.7

Can't change node version - Windows

Working on windows x64
Tryied different thing to use node version 10.19.0 but nothing work.
What I dont understand is following behavior
I installed nvm
node -v return v12.16.1
nvm list return
10.19.0
5.4.0
should'nt nvm list return avaible version of nodejs?`
Edit:
I tryed nvm use 10.19.0 but doesnt seem to work
nvm use 12.16.1 return node v12.16.1 (64-bit) is not installed.
I had nodeJs installed in path
C:\Program Files\nodejs
Installing new version of node with nvm was installing in
C:\Users\{myname}\AppData\Roaming\nvm
I changed windows variable NVM_SYMLINK to path
C:\Users\{myname}\AppData\Roaming\nvm

Resources