As the title says, I'm on Windows 10 and I'm using the latest 1.1.9 nvm version.
I keep two node versions, one for work and one for my personal use.
I want to set aliases for them but the command doesn't work.
When I type
nvm alias work 10.16.0 (I have the version installed)
I get listed the running version of nvm and the usage guide.
Then when I try
nvm use work
it says that "work" isn't a recognised version.
According to the GitHub Repository Issues, this version of nvm doesn't have a feature for Aliases.
on a Windows 10 machine and using nvm4w I tried:
from the above image:
node --version to check the current version
nvm list to list installed versions
nvm use 8.8.1 so we switch from 6 to 8
nvm on to enable it
node --version to re-check the node version
what am I doing wrong?
I had to delete the folder located at C:\Program Files\nodejs:
And then run nvm use {version} again to repopulate this folder with the correct node version.
I suspect that nvm is having trouble deleting this folder due to permission issues.
So I found a workaround.
I renamed C:\Program Files\nodejs to C:\Program Files\nodejsx
and then running nvm use versionNumber works fine.
Seems like nvm cannot change it to a symlink and fails silently.
I was also facing the same issue.
I had node version 14.15.1 installed in my machine and had to use 12.16.1
I'm using Windows 10.
After installing 12.16.1 via nvm it was showing only this version in nvm list and it wasn't showing current version in use.
Even after node use 12.16.1 the node -v was still showing 14.15.1.
Steps to resolve this issue:
Uninstall Nodejs from control panel.
Install Nodejs 12.16.1 using nvm install 12.16.1
Install Nodejs 14.15.1 using nvm install 14.15.1 (or the version which got uninstalled)
Switch version using nvm use 12.16.1 (change the version number accordingly)
Result:
C:\>nvm list
14.15.1
* 12.16.1 (Currently using 64-bit executable)
12.3.1
C:\>node -v
v12.16.1
nvm works based on the fundamental idea of symlinks. When a user is trying to hit the command nvm install <node_version> the entered version of node is getting installed even if you have changed the C:\Program Files\nodejs to C:\Program Files\nodejsx.
If nvm fails to create the new folder C:\Program Files\nodejs it will fail silently and you won't be informed.
You must manually check for the existence of the path C:\Program Files\nodejs if it exits then delete the folder and change the node path in your environmental variables. This will help you to figure out the version of the npm command.
Your problem can be solved by reinstalling the nvm version with Administrator privileges or just by renaming the folder C:\Program Files\nodejs
You can find further information here: https://github.com/coreybutler/nvm-windows/issues/67
This happens to be the issue till date and deleting nodejs folder does not work.
Just run nvm install using cmd as administrator.
So even if you have downloaded nodejs from cmd without admin privilages, uninstall it and install again using cmd as admin.
This is what worked for me after trying almost every solution from github and stackoverflow.
For me the problem (on Linux) was that I had installed node with Homebrew, and it was preventing the use of nvm. Before nvm could set up the correct symlink, I had to
brew uninstall node
I first found out about this situation by running
which node
This told me that node was being symlinked from Homebrew at
/home/linuxbrew/.linuxbrew/bin/node
instead of, as we want, from nvm at
/home/john/.nvm/versions...
As soon as "which node" reported that it was using the node from nvm, things were resolved for me.
1) Install NVM from the link : https://github.com/coreybutler/nvm-windows/releases.
2) Copy the settings.txt from the "C:\Users\YOUR_USERNAME\AppData\Roaming\nvm". to "C:\Users\ YOUR_USERNAME"
3) Restart your system for the changes to reflect.
4) Open the console and type below command :
nvm list
5) To install the 6.9.3 version run the below command :
nvm install 6.9.3
6) After the installation is complete it will add the node version in the nvm. To check the same type command :
nvm list
7) To switch the command version type command below command :
nvm use 6.9.3
To verify the node version switch type the command “node –v”
8) Its will display the node version in use.
For more details please check the below link :
https://www.tutespace.com/2018/11/nvm-installation-on-windows.html
Let us know if you still face the same issue.
I had the same problem.
My solution is that i uninstalled nodejs via chocolatey (the way i installed it) and then nvm worked again.
After checking the nodejs folder in C:/Program Files i noticed that nvm probably works via creating a link/shortcut to the nvm folder where the different versions of nodejs are stored. That´s the way the "Path" and everything works.
I hope that helped.
I have tried to switch Node version using nvm but it is not reflecting so I deleted the folder inside c:/program files/nodejs
after deleting the folder follow the same steps to switch the npm version using nvm and it will switch the node version.
The steps I had to follow were:
Uninstall node if there was an installation outside of nvm
Ensure "C:\Program Files\nodejs" was deleted before installing nvm
Install nvm which still fails to install node but from the errors it seems that's because its ultimately pointing at urls that have been decomissioned
Use "nvm install NODE_VERSION" to install at least 2 versions of node which again fail as in 3)
Download the versions of node I tried to install and unzip the entire contents to their respective %appdata%/nvm/vNode_version folders
Use "nvm use NODE_VERSION" to switch between either version I've installed [but be careful... "npm -v" did not work until in visual studio until I closed and re-opened the program]
If anyone knows how to point nvm to the up to date urls, it'd be great to know. I suspect everything would work fine when running nvm from powershell run as administrator
Follow this step
1.delete node and npm in path
To Find Path
which node
output
/c/Users/balaji/AppData/Roaming/npm/node
which npm
output
/c/program files/node.js
2.To list out version
nvm list
3.set node
nvm use version
To know remote version
nvm list available
To know local version
nvm list
Yet another answer because none of the others helped me.
Setup
Windows 11
Multiple accounts
Non-default install and symlink directories
I installed nvm using different directories than the default because this is necessary to avoid:
Issues due to spaces in the path
Issues when using nvm on two different accounts on the same machine
Solution
This solution works for any number of accounts on the same machine.
Uninstall any nvm and nodejs you have.
Make sure no directory from them remains (in Program Files, Program Files (x86) and any other place you might have tried installing nvm/nodejs)
Reinstall nvm with:
An installation path that contains no spaces, and is not in any specific user's directory (e.g. C:\nvm)
A symlink path that contains no spaces, is not in any specific user's directory, and is not under nvm's directory (e.g. C:\nodejs)
Open your shell as administrator, install your desired node version(s) (e.g. nvm install lts) and activate one (e.g. nvm use 18)
Test that the version was activated correctly with nvm current and node --version
Every time you change your node version with nvm use or install a new one with nvm install, do it in an administrator shell
None of the above helped in my case.
I could see the symlink was created and correct but NVM4W would still not "use" the correct version.
The node version I had installed with NVM was not compatible with my version of Windows.
When you run "nvm ls" or "nvm current", it calls GetCurrentVersion() which runs "node -v" in the command line. If that output is anything other than the current version, such as the warning that you are running an incompatible OS, it will fail to indicate the currently selected version. It does so in a way that is not obvious why "nvm use x" did not work.
You can bypass the node OS check with an environment variable (node version >=14 as far as I could find):
How to set the NODE_SKIP_PLATFORM_CHECK environment variable to 1 which skips the version check
Though you may need to update Windows or use an earlier version of node if node doesn't function as expected.
With that set, "nvm use" functioned as expected.
I met this problem this morning. And I think the reason for the problem is that it's different between the nvm's settings and env configuration. I solved it the following way.
open the path of nvm installation.
open the setting.txt file and have a check with the path value.
open the environment variables Control panel in Windows.
check if it's the same between the value of NVM_SYMLINK in the system path and path in the setting.txt
change two configuration to same values.
Mine was caused by EMSDK. which I set on my .zshrc to load it automatically. removed the emsdk related lines, and the node was following nvm.
On Windows uninstalling Node.js at Control Panel > Programs > Uninstall a program, and letting nvm install the desired node versions also solves this issue.
In my case the things didn't work as described inside CI/CD service (TeamCity to be exact). I spent half a day, trying to find a solution and tried everything mentioned here and other similar questions. So, what worked:
Perform a clean install of nvm (removing older standalone versions of nodejs fist), as specified by multiple other answers. Install node versions only using nvm.
Make sure that process that is running your "nvm use" command has "Full Control" privilege to the root of nvm installation. So that it could delete the symbolic link "nodejs" folder when switching versions.
Change a policy on your server to allow that same account creating symbolic links:
This point was, somehow, not mentioned by anyone anywhere, so it took me very long time to figure this out.
I used Homebrew to install yarn. Running yarn -v shows that I currently use 0.23.2. I ran brew upgrade yarn to get the latest version, which is 0.24.6.
After Homebrew successfully upgrades yarn, I run yarn -v again, but the version is still 0.23.2. How can I change the version of yarn that I am running?
yarn policies set-version <version number>
Per https://github.com/yarnpkg/yarn/issues/7146#issuecomment-477809216
You can use homebrew and yarn formula URLs to install older versions of yarn, then brew switch between yarn versions as needed. Works perfectly! Credit to github user robertmorgan.
First off, if you already have a version installed, unlink it from brew running the brew unlink yarn command in your terminal.
Next, in a web browser, find the Pull Request that has been merged which contained the formula (version) of
Yarn
that you want to install.
View the files changed in that Pull Request - there should be one for Formula/yarn.rb.
Click the "View" button for the Formula/yarn.rb file to see the whole contents of the file for that commit.
Click the button to view the "Raw" version of that file. This will open a url which should start with
https://raw.githubusercontent.com/....
This is the URL that you will need for the next step - so copy the complete URL to your clipboard.
Back in your terminal window, use the command brew install followed by the URL that you've copied.
e.g. to install v1.6.0 of yarn it would be:
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/fba7635ab69384ac980c635483a7af825bc06088/Formula/yarn.rb
You can then verify the versions available to Homebrew by running:
brew list --versions yarn, and switch between versions using brew switch yarn VERSION_NUMBER
Source: https://github.com/yarnpkg/yarn/issues/1882#issuecomment-421372892
I found an answer. It's not the prettiest, but since yarn always tell me what the most update-to-date version is, I can use npm to just install the latest version.
If the latest is 0.24.6
npm install --global yarn#.24.6
EDIT:
According to yarn's official documentation, the way to install/upgrade is:
brew install yarn
brew upgrade yarn
https://yarnpkg.com/en/docs/install#mac-stable
Your best bet would be to use a yarn version manager.
Install:
curl -fsSL https://raw.githubusercontent.com/tophat/yvm/master/scripts/install.sh | bash
Single usage:
yvm exec <version> <command>
Or to switch your currently running yarn version
yvm use <version>
yarn --version
UPDATE Dec 2021:
Sadly brew switch is deprecated in Homebrew 2.6.0 (December 2020)
$ brew switch
Error: Unknown command: switch
TLDR, to switch version:
brew unlink yarn
brew link yarn#<new_version>
Old solution:
Assuming that you have the other version installed, you can run
brew switch yarn <old_version>
To list the versions you have installed:
brew list --versions yarn
You can use
yarn set version <version>
For example, if you want the latest version, you can run
yarn set version latest
You can also set it to a specific number, for example,
yarn set version 1.22.1
You can view the full documentation at the official website.
Note 1: A bug stops you from switching from yarn 2 to yarn 1. There are solutions to this in this GitHub issue.
Note 2: I don't use brew, but this solution should still work.
Easily install and switch between any number of yarn versions.
https://github.com/tophat/yvm
Here's a way to do it with only curl and bash:
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 0.24.6 # or another version
This works whether you have yarn installed or not.
For updating version on macOS use below command:
$ brew upgrade yarn
Some of the above answers don't seem to work anymore. Here is how I was able to install a different version in April 2021:
brew unlink yarn#1.6.0 (If you already have a version installed)
brew extract --version 1.22.4 yarn homebrew/cask
brew install yarn#1.22.4
yarn -v
I installed NodeSource's NSolid on my computer and it took over my node binary. How do I uninstall it?
NSolid provide an uninstall script. On a Mac, simply run:
sudo /usr/local/nsolid/uninstall
N|Solid replace node binary to ensure that all your apps are getting the additional features of N|Solid. The best way to return to Node.js again is reinstalling it.
N|Solid is shipped with a specific npm version that guarantee total harmony on the ecosystem. Reinstalling Node.js also replace the npm version avoiding issues about version miss matching.
Also you should remove manually the nsolid binary. You can get the installed path running which nsolid
I want to install an old version of phantomjs (1.9.1). If I run
brew install phantomjs
It installs the new version (2.0.0).
You can find supported prior versions in the homebrew-versions repository. There isn't a formula for 1.9.1 but you can install 1.9.2 with brew install homebrew/versions/phantomjs192. (You could contribute one for 1.9.1 if you really need it.) You can look for versioned formulas with brew search phantomjs.
Please, try this command:
brew install https://raw.githubusercontent.com/Homebrew/homebrew-versions/master/phantomjs182.rb