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:

  1. Download zip file.

  2. Unzip and install it.

  3. Configure the env path.

  4. Try to run ‘nvm v’ and it works well. image

  5. Try to install nodejs nvm install 4.2.4 64, after a while it tells me installation completed and suggests to run nvm use 4.2.4 to use it. image

  6. I run node -v to see if it really works. Unfortunately, I met some error msg. image 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)

Most upvoted comments

If anyone else encountered an issue where the node or npm commands were not found after installing and using a version, I managed to resolve this by turning nvm on and off:

nvm off

nvm on

example

I have the same problem. Currently using Windows 10 and have Windows Defender running.

  1. Windows Defender doesn’t recognize any threats while running the nvm install.
  2. I am using administrator mode for the command prompt
  3. I do not see any error message during the node install :

nvm_problem_01

  1. nvm list gives me the following output : nvm_problem_02

  2. 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 :

  1. I’ve reinstalled nvm with different NVM_SYMLINK path ( changed from c:\program files\nodejs to c:\nodejs )

  2. Used PowerShell with admin rights

  3. 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…

  1. Reinstalled nvm as admin (even though I am using admin account)
  2. nvm on
  3. Installed a single node version as admin with Powershell. I am using windows 10.

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:

  • Uninstalling nvm
  • Installing it on nondefault folders (C:\nvm and C:\nodejs)
  • Altering manually the %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 and node as the admin after default install). However, if you choose different install directories, other than the defaults (I used c:/nodejs for Node and c:/bin/nvm for NVM) it works perfectly. I no longer need to be admin to run node or nvm. No special setup or configuration, just select different install locations and that was it.

If anyone else encountered an issue where the node or npm commands were not found after installing and using a version, I managed to resolve this by turning nvm on and off:

nvm off

nvm on

example

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: image

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.