ChatGPT解决这个技术问题 Extra ChatGPT

Why isn't Node Version Manager (NVM) recognized on Windows?

I am trying to downgrade my version of node

I ran:

npm install nvm

and I exported the bin folder to my Windows path variable,

C:\Program Files (x86)\nodejs\node_modules\npm\bin

but I still get:

'nvm' is not recognized as a an internal or external command.

Should I be adding another path to my path variable?


u
urig

nvm was designed for Linux. nvmw, which is completely different, broke around node v0.10.30. Try NVM for Windows.


If we uninstall node js while install nvmw then how nodejs will work afterward? Please guide. Do we need to reinstall nodejs?
Corey I have intsalled nvmw and run nvm install 9.10 to install node version 9.10. now I have path C:\Users\simer\AppData\Roaming\nvm\v9.10.0 and C:\Users\simer\AppData\Roaming\nvm\v9.10.0\node_modules\npm node and npm both path are not working and not recognized as command. Please help.
@Simer - these should be written out as new questions. Before you do do, check the closed issues at github.com/coreybutler/nvm-windows because there are several answers to your second question.
FWIW, there is also one called nodist. I haven't tried it but in the past have run into problems with nvm-windows related to needing to run as administrator, having paths with spaces, using shells other than cmd.exe, etc. Though, just now I see that Corey's putting some TLC into this again (automated releases and such), so perhaps those are about to become history.
For future reference: NVM for Windows does not support .nvmrc files, and the developer explicitly stated in one of the issues that he won't accept any PRs on that regard either.
R
Ritu Gupta

Nvm can be used to manage various node version :

Step1: Download nvm for Windows

Step2: Choose nvm-setup.zip

Step3: Unzip & click on installer.

Step4: Check if nvm properly installed, In new command prompt type nvm

Step5: Install node js using nvm : nvm install : The version can be a node.js version or "latest" for the latest stable version

Step6: check node version - node -v

Step7(Optional)If you want to install another version of node js - Use STEP 5 with different version.

Step8: Check list node js version - nvm list

Step9: If you want to use specific node version do - nvm use


important point to note: nvm command is recognized in powershell/cmd in administrator mode only
node is not recognized after installing with nvm. What can be the issue?
After installation, Please use freshly opened command prompt.
in Windows 11 Pro, nvm command is recognized in powershell/cmd in non-elevated cmd, and we can install new versions; but for nvm use <version>, it is necessary to be elevated as admin
S
Shrinivas Kalangutkar

NVM Installation & usage on Windows

Below are the steps for NVM Installation on Windows:

NVM stands for node version manager, which will help to switch between node versions while also allowing to work with multiple npm versions.

Install nvm setup.

Use command nvm list to check list of installed node versions.

Example: Type nvm use 6.9.3 to switch versions.

For more info


The link is no longer available.
C
Claudiu

As an node manager alternative you can use Volta from LinkedIn.


J
Joel Chen

I created a universal nvm that works on both Unix (bash) and Windows, base on another simple nvm.

It doesn't need admin on Windows, but requires PowerShell 4+ and the right to execute scripts.

https://www.npmjs.com/package/@jchip/nvm#installation


the only one that worked for me without admin rights. Would love to see the library keeping on support
n
nilakantha singh deo

The first thing that we need to do is install NVM.

Uninstall existing version of node since we won’t be using it anymore Delete any existing nodejs installation directories. e.g. “C:\Program Files\nodejs”) that might remain. NVM’s generated symlink will not overwrite an existing (even empty) installation directory. Delete the npm install directory at C:\Users[Your User]\AppData\Roaming\npm We are now ready to install nvm. Download the installer from https://github.com/coreybutler/nvm/releases

To upgrade, run the new installer. It will safely overwrite the files it needs to update without touching your node.js installations. Make sure you use the same installation and symlink folder. If you originally installed to the default locations, you just need to click “next” on each window until it finishes.

Credits Directly copied from : https://digitaldrummerj.me/windows-running-multiple-versions-of-node/


M
Mustkeem K

I will list two ways. You can choose one Whichever works for you.

1. Using installer

Download nvm-setup.zip and unzip the file and install it, keeping the configurations default.

1. Use curl Copy the below command and run it in your terminal

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash

After this reopen/open terminal and check the nvm version runing below command.

nvm -v

And that's it.


#1 worked for me in 2022 on windows 10 x64 where nothing else did.
v
vimal krishna

If someone is looking for install on Window 11! Not directly relevant here, but might be useful.

It is immaterial if you install NVM (version 1.1.9.) say after the node (16.15.1) is already installed. During the nvm installation process, it asks for the right to manage the existing node version and symlinks that.

Get the version from the GitHub repo, I opted for the zip version.

https://github.com/coreybutler/nvm-windows/releases

Double click the application and it is just a few steps.


I tried this on windows 10 and it worked once I took the right zip file to download from the latest releases. For anyone doing this I got confused as this is not the same as the main github software download (which I tried at first and had only a .bat file in). If you have anything other than "nvp-setup.exe" in the zip, then you have probably downloaded the wrong thing for windows install. This is easier than all the articles on how to do this which are pre 2022 and imply it is a big job. It isnt. run that exe and follow vimals instructions and its done. easy.
A
Andre Cytryn
1.downlad nvm 
2.install chocolatey
3.change C:\Program Files\node   to C:\Program Files\nodejsx

emphasized textThe first thing that we need to do is install NVM. website : https://docs.microsoft.com/en-us/windows/nodejs/setup-on-windows


N
Neenus

So this answer is for windows users that are using git bash or some other console emulator like cmder ... if you're using CMD this solution will not work for you also why? why are you still using CMD?

I know this is a pretty old post but I just achieved this yesterday and wanted to add my answer for anyone looking to do the same.

First check if you have .bashrc profile in your home directory by typing ls -alh ~ (by default this doesn't exist)

if it doesn't exist type this command to generate a .bashrc profile with default values in it cat /etc/bash.bashrc > ~/.bashrc (if it does exist skip this step)

Download and run the nvm install script as provided in the nvm docs page curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash (make sure you do this in your home directory)

then edit the new generated .bashrc profile file you created above; use nano/vim to do that nano ~/.bashrc and add the following to the bottom of the file export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm and save your .bashrc file with the changes.

lastly source your .bashrc file by typing source ~/.bashrc

verify installation nvm --version

and now you have nvm installed and you can use the commands as per https://github.com/nvm-sh/nvm#usage


l
loganfsmyth

First off, I use nvm on linux machine.

When looking at the documentation for nvm at https://www.npmjs.org/package/nvm, it recommendations that you install nvm globally using the -g switch.

npm install -g nvm

Also there is a . in the path variable that they recommend.

export PATH=./node_modules/.bin:$PATH

so maybe your path should be

C:\Program Files (x86)\nodejs\node_modules\npm\\.bin

the g switch seemed to make things work on my Windows 7 machine, thanks
i set path as u say but when i try to nvm install 6.9.1 this error occurs Could not retrieve nodejs.org/dist/latest/SHASUMS256.txt. Get nodejs.org/dist/latest/SHASUMS256.txt: dial tcp 104.20.22.46:443: i/o timeout
" npm install -g nvm " is not the correct way to install nvm
D
David Dostal

An alternative to nvm-windows, which is mentioned in other answers would be Nodist.

I've had some issues with nvm-windows and admin privileges, which Nodist doesn't seem to have.


v
vibhu

I know I'm late here but this may help in the future if someone looking for NVM to install in Windows or linux run this command in cmd

       $ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash

This worked. After installing, use git bash and run these commands. export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm