nvm-windows node 8.9.4 installation error

When attempting to install node version 8.9.4 with NVM for windows, I received an error when it attempted to install npm, indicating that a file name was too long. There are a number of GitHub issues related to this, with many suggestions; some involving moving files around, some suggesting deleting files. In many cases, these solutions didn’t work. I found the solutions overly complex.

My solution is fairly simple:

  1. Run “nvm root c:\nvm-windows”
  2. Copy elevate.cmd and elevate.vbs from c:\Users\<username>\AppData\Roaming\nvm to c:\nvm-windows
  3. Copy vXXX versions of node from c:\Users\<username>\AppData\Roaming\nvm to c:\nvm-windows
    1. This is optional, and only if you want to preserve your old versions of node
  4. Run “nvm install 8.9.4”

This solution changes the directory that NVM stores its versions of node. The default path that nvm stores different versions of node is lengthy. If you move it to a path closer to c: then NVM doesn’t have problems with file names being too long while installing.

Leave a Reply

Your email address will not be published. Required fields are marked *