nvm-windows: nvm install fails with "The filename or extension is too long"
My Environment
Windows 8
I’m using NVM4W version:
1.1.5
My issue is related to (check only those which apply):
- settings.txt
- proxy support (Have you tried version 1.1.0+?)
- 32 or 64 bit support (Have you tried version 1.1.3+?)
- Character escaping (Have you tried version 1.1.6+?)
- A standard shell environment (terminal/powershell)
- A non-standard shell environment (Cmder, Hyper, Cygwin, git)
Expected Behavior
Install node version 8.2.1
Actual Behavior
Fails with error The filename or extension is too long
Steps to reproduce the problem:
λ nvm install 8.2.1
Downloading node.js version 8.2.1 (64-bit)...
Complete
Downloading npm version 5.3.0... Complete
Installing npm v5.3.0...2017/07/21 09:02:31 mkdir C:\Users\suhas.karanth.RB\AppData\Roaming\nvm\temp\nvm-npm\npm-5.3.0\node_modules\libnpx\node_modules\yargs\node_modules\read-pkg-up\node_modules\read-pkg\node_modules\load-json-file\node_modules\parse-json\node_modules\error-ex\node_modules\is-arrayish: The filename or extension is too long.
While this is an issue, I doubt there is a direct way to fix it. However, creating this issue to share how I got around it and how maybe it could be avoided.
I installed the latest pre-release version of nvm(v1.1.6
) but this time installed it to C:\nvm\
to conserve path length. Was able to successfully install node v8.2.1
after this. Do you think it makes sense to install nvm to this path by default?
About this issue
- Original URL
- State: open
- Created 7 years ago
- Reactions: 10
- Comments: 25 (5 by maintainers)
If you install latest (1.1.6) and instead of
C:/Users/<username>/AppData/Roaming/nvm
you selectC:/nvm
as the installation folder, it should work. I had no problem installing8.4.0
😃For me, using
nvm root
to change the path ofnvm
did not work, I got weird error messages. It did not copynvm <commands>
and then evennode
stopped working.Manually cloning
npm
as @michaelkdh suggested did also not work, and seems hackish compared to a clean installationFrom: C:\Users\[username]\AppData\Roaming\nvm
elevate.cmd
andelevate.vbs
to: C:\nvmThen it worked for me!
Installing nvm 1.1.6 fix bug with “npm installing: The filename or extension is too long”
Thanks @computerquip-streamlabs. I got this problem and solved by upgrading nvm with,
And then I could install node 8.7.0 with nvm.
I had the same issue, the solution i have is to:
git clone https://github.com/npm/npm.git
then you should be good
FWIW, I’m running Windows 10, I did enable long file paths, but still couldn’t install node versions above 6.x… because of the issue with long file path in npm v 5.6, upgrading to nvm 1.1.6 fixed the issue for me.
I’m also on nvm version 1.1.5 if that makes a difference (maybe you’re on 1.1.6?)
I can confirm that the upgrade to 1.1.6 fixes this issue. Makes sense since it looks like some of the filepath management now uses native Go libraries.
That would also mean that the filepath bug was within nvm rather than npm itself. Any bug filed over at npm might want to be looked over again.
@coreybutler Here you go, with cmd.exe
C:\Users\Christopher>nvm install 8.4.0 Downloading node.js version 8.4.0 (64-bit)… Complete Creating C:\Users\Christopher\AppData\Roaming\nvm\temp
Downloading npm version 5.3.0… Complete Installing npm v5.3.0…2017/09/05 16:50:14 mkdir C:\Users\Christopher\AppData\Roaming\nvm\temp\nvm-npm\npm-5.3.0\node_modules\libnpx\node_modules\yargs\node_modules\read-pkg-up\node_modules\read-pkg\node_modules\load-json-file\node_modules\parse-json\node_modules\error-ex\node_modules\is-arrayish: The filename or extension is too long.
C:\Users\Christopher>where nvm C:\Users\Christopher\AppData\Roaming\nvm\nvm.exe
C:\Users\Christopher>nvm install 8.4.0 Downloading node.js version 8.4.0 (64-bit)… Complete Creating C:\Users\Christopher\AppData\Roaming\nvm\temp
Downloading npm version 5.3.0… Complete Installing npm v5.3.0…2017/09/05 16:50:14 mkdir C:\Users\Christopher\AppData\Roaming\nvm\temp\nvm-npm\npm-5.3.0\node_modules\libnpx\node_modules\yargs\node_modules\read-pkg-up\node_modules\read-pkg\node_modules\load-json-file\node_modules\parse-json\node_modules\error-ex\node_modules\is-arrayish: The filename or extension is too long.
C:\Users\Christopher>where node C:\Program Files\nodejs\node.exe
C:\Users\Christopher>where npm C:\Program Files\nodejs\npm C:\Program Files\nodejs\npm.cmd
@coreybutler According to the issue you linked you can override the paths to install to.
There do appear to be a number of issues with the new versions of npm, specifically those that include npx support. I’ve added support for npx in the master branch and will release it when 1.1.6 becomes official (currently being tested). However; even in that branch, npx still fails (it also fails through the standalone windows Node installer without NVM4W).
I believe this is an npm issue, not an NVM4W issue. I’m closing the issue and marking it as an upstream-issue.