nvm-windows: [Help]Cannot run 'node' or 'npm' command after nvm installed
I’m trying to install nvm on my windows8.1(64bits). I do as the below orders:
-
Download zip file.
-
Unzip and install it.
-
Configure the env path.
-
Try to run ‘nvm v’ and it works well.
-
Try to install nodejs
nvm install 4.2.4 64
, after a while it tells me installation completed and suggests to runnvm use 4.2.4
to use it. -
I run
node -v
to see if it really works. Unfortunately, I met some error msg.It means ‘This application cannot be run on your computer.’
It confused me. Did anyone meet the same error before? And How to solve it ??
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 43 (3 by maintainers)
If anyone else encountered an issue where the
node
ornpm
commands were not found after installing and using a version, I managed to resolve this by turningnvm
on and off:nvm off
nvm on
I have the same problem. Currently using Windows 10 and have Windows Defender running.
nvm list gives me the following output :
c:\program files\nodejs folder only contains node_modules folder which makes me think that the nvm installation wasn’t completed properly.
Any suggestions?
— Update ----
I have resolved the issue by doing the following :
I’ve reinstalled nvm with different NVM_SYMLINK path ( changed from c:\program files\nodejs to c:\nodejs )
Used PowerShell with admin rights
Typed command [nvm on], which copied the node & npm to the NVM_SYMLINK folder ( this command didn’t do anything with previous set ups, now it copies the files properly ).
My guess is that even though I was running the command prompt with admin right, it didn’t have the write access to \program files\nodejs folder.
Just run into this issue with nvm v1.1.7 on Windows 10. The solution in my case was to completely delete ‘C:\Program Files\nodejs’ directory (it existed after NodeJS uninstall). After that
nvm use 11.8.0
started working normally.You will need to run this inside an “Administrator” or elevated command prompt. To change/create the symlinks nvm requires Administrator permissions.
You can probably run regular ‘node’ and ‘npm’ commands and some of the non-modifying ‘nvm’ commands in a non-Administrator prompt, but to make changes to the symlink it requires elevation.
I fixed mine like this…
This is a nightmare. I mean to make this work. I tried all the above: install nvm into something else then Program Files, used PowelShell (Admin) to launch the install, switched on/off nvm, basically none of them worked. Strange thing is that when I tried to install into something else then Program Files (like c:\nodejs), nvm install deleted the target directory and nothing got installed. I’m using Windows 10. At this poitn I’m not recommending using this product to manage multiple node version.
I finally fixed this in Windows 7 by:
C:\nvm
andC:\nodejs
)%PATH%
to use these paths directly instead of%NVM_HOME%
and%NVM_SYMLINK%
nvm install 10.15.0
nvm off
nvm on
nvm use 10.15.0
I had the same problem (I could only run
nvm
andnode
as the admin after default install). However, if you choose different install directories, other than the defaults (I usedc:/nodejs
for Node andc:/bin/nvm
for NVM) it works perfectly. I no longer need to be admin to runnode
ornvm
. No special setup or configuration, just select different install locations and that was it.Great! it works. Just run as admin
Still getting this problem with 1.1.7 on windows 10. node -v works fine but npm -v gives me:
Also, my nod_modules folder is empty
If you’re downloading the manual installer, this is the experience you can likely expect because nothing is setup for you. This is why I made the installer. It prepares everything for you, including permissions. Keep in mind it is not enough to run this as an administrator on some versions of Windows. Later versions of Windows requires elevated admin privileges, though in most scenarios it should prompt you when you install a new version or make a switch.
If you install NVM4W anywhere within
C:\Program Files\
, you must use an account with admin privileges. This is a restriction of Windows itself, which considers this a protected directory.If you’re having problems with persisting a version of Node, make sure your account has write permissions on the NVM for Windows user data directory. This is required to write the
settings.txt
file.If you’re on Windows 7, please read about Windows 7 support.