I'm using NVM (Node version manager) version 1.1.7 on Windows 10 to update Node through the Powershell terminal on VSCode. Today it occured to me that even though after updating and using nvm use 14.15.4 and getting 2 elevation dialogs and NVM telling me that it's now using the newest version, when I do nvm list or node -v or get-command node they're all still telling me that it uses an older version of Node.
After looking around for a bit some solutions said to add "runtimeExecutable": "/Users/*user*/.nvm/versions/node/*version*/bin/node" to the launch.json of VSCode, but that specific path doesn't even exist on my computer.
Check if nvm alias default <version> solves the problem
Related
I've installed the latest node version as you can see in the image on the left-hand terminal. I updated to the latest LTS ages ago, but whenever I start up a new window (right-hand terminal) I'm apparently still using an older version of node. In this screenshot too, I switched to the latest LTS and then opened the right-hand terminal, but it's still saying I'm using 12.20.1.
How can I ensure I have the latest LTS version of node each time I open my terminal?
If it's relevant: I'm using iTerm2, but I get the same response when I use the native Mac terminal or when I use the embedded VSCode terminal.
You should actually update the version by passing it to NVM:
nvm list // will give list
nvm use nodeversion
nvm alias default nodeversion
Now, restart your terminal and check node version. It will be the last updated one. Whenever you change the version try to change the default version to new one.
Updating node to latest:
nvm alias default node
nvm use default
I updated my node version from 8.x.x to 13.x.x using the cmds below:
nvm install stable
Running node -v immediately after this, shows the updated version. But re-opening the terminal the older version of node persists.
I had to do: nvm use 13 to enable node 13.x.x
What is the ideal way to keep using the latest node version with explicitly using nvm use every time?
nvm alias default 13
This solved the issue and set the node version permanent to 13.x.x
I am trying to update my local node version from 8.9.0 to 8.10.0 using nvm. But it's not getting reflected. Here's what I tried:
node -v
-> v8.9.0
nvm use 8.10.0
-> Now using node v8.10.0 (npm v5.5.1)
node -v
-> v8.9.0
I am unable to get why it won't change. Please let me know what have I done wrong.
Adding few notes about my experience on debugging this problem.
First, I started out with the command provided by Jonathan which -a node and got the same output as op:
/usr/local/bin/node
/Users/<my-user>/.nvm/versions/node/v8.10.0/bin/node
Moving on to the next comment by Jonathan: Have you installed Node via Homebrew as well?, I tried uninstalling node by brew uninstall node and got and error that said it could not uninstall node as there was another program dependent on it. yarn.
And then realised that brew had installed its own version of node because I installed yarn through brew, which was overwriting the node version that I wanted to use through nvm.
Uninstalling brew's version of yarn+node fixed my problem.
I still needed yarn, and now I have to install yarn globally for each node version managed by nvm.
Inconvenient, I agree. But so is maintaining twenty thousand versions of node for each project so not very different in my opinion.
All of this was done on M1 MacOS and your output might vary based on your system.
Please ensure that when you input arch on command prompt, then output is i386.
This is achieved using Rosetta.
Following sequence of commands on terminal worked: -
nvm install 8.10.0
nvm install --lts
nvm ls
brew upgrade
arch -arm64 brew install n
n
Now select node version 8.10.0 using up or down arrow keys in keyboard and then quit from command prompt using command+q
Please do not try brew uninstall --ignore-dependencies node
Just check you environment variables first. It might be mapping to node#8.9.0.
You need to remove the environment variable first.
If you are also using volta. Volta may take precedence.
Use which -a node to verify.
If that is the case, use volta pin node#version to switch.
First check your nvm version installed on your local system. go to command prompt and type "nvm list" If you don't see the versions 8.10.0 in the list then install using command : "nvm install 8.10.0" and then try "nvm use 8.10.0".
For reference : http://www.tutorial-points.com/2018/11/nvm-installation-on-windows.html
I want to use an older version of Node.js in my application, and for that I have attempted to use nvm so that I can change the version accordingly.
Now I have three versions of Node.js and want to switch on specific version
nvm use [selected version]
It is successfully executed but the version is not updated
Example of use:
If your nvm command not updating your node version in windows, for example
Your current version is 6.11.2 and you would like to update to 8.11.3 using nvm use 8.11.3 in windows OS then below hack will do that job.
Renamed C:\Program Files\nodejs to C:\Program Files\nodejsx it worked for me.
Credit goes to user ituasdu
From the readme of NVM, under important notes:
Note: nvm does not support Windows (see #284). Two alternatives exist, which are neither supported nor developed by us:
nvm-windows
nodist
Have installed node 0.12.2, but need to revert to 0.10.33 to run the applications I need to.
I have tried installing 0.10.33 and switching versions using
set 0.10.33 to default with 'nvm alias default 0.10.33'
But node runs previous version (0.12.2) when started again.
I have tried uninstalling node via various methods, but each one has been blocked:
uninstall node
"You must be in root to run this tool"
(I am the only user (with Admin access) on my machine
I tried
cd /
then
uninstall node
But still got
"You must be in root to run this tool"
Tried
sudo uninstall node
"Uninstall Failed...
Reason: ErrorMissingBundle"
I may have installed node with Homebrew - it was a while back, can't quite remember. So tried:
brew uninstall node
"Error: No such keg: /usr/local/Cellar/node"
Other information I can give:
which node
/usr/local/bin/node
I see node and npm in
/usr/local/bin
Any help most appreciated - I'm not a command line expert, and fairly new at Node.
To switch from different node.js version with nvm just use nvm use 0.10.33
It looks like you might be using NVM (node version manager). If you are you can install different versions using
nvm install version_no
and then you can switch versions using the command
nvm use version_no
If you have not used NVM to install node you can uninstall node using the instructions in this answer - How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X).
Then if you need different versions of node I would recommend using NVM, which allows you to install and use different versions of node on the same system. https://github.com/creationix/nvm