Windows 8
1.1.5
Install node version 8.2.1
Fails with error The filename or extension is too long
位 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?
Something is off about this installation... Did you have two versions of NVM installed at the same time by any chance?
It may be too late at this point, but what does echo %NVM_SYMLINK%
output?
No. I did not have 2 versions of NVM installed at the time when the error occurred.
It may be too late at this point, but what does
echo %NVM_SYMLINK%
output?
Actually, not too late. I had a terminal open which still had the older environment.
位 where nvm
C:\Users\suhas.karanth.RB\AppData\Roaming\nvm\nvm.exe
位 echo %NVM_SYMLINK%
C:\Program Files\nodejs
Additionally, I had installed and was using multiple versions of node through NVM before:
位 nvm list
* 8.1.2 (Currently using 64-bit executable)
8.1.1
8.1.0
8.0.0
6.10.3
6.10.0
5.12.0
4.8.0
4.2.6
I am having the same issue.
Windows 10
Cmder shell
NVM 1.1.5
This is occurring with node 8.2.0
and 8.2.1
8.1.4
and 8.1.3
are working fine.
$ nvm install 8.2.0
Downloading node.js version 8.2.0 (64-bit)...
Complete
Downloading npm version 5.3.0... Complete
Installing npm v5.3.0...2017/07/22 00:15:41 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.
I wonder if we should take this up with npm upstream..
@clowenhg If you install nvm directly to C:\nvm
, the issue will be resolved but your existing node installations will not longer be recognised. I had moved the multiple node folders to C:\nvm
and was able to see them listed but never got a chance to test any of it out. Thanks to windows update and boot loop.
That would probably work, but just seems like a temporary work around until the next thing wants to go one more directory deep. So yea, raising this as an issue for NPM would probably be a good call.
Seeing as 8 isn't at it's final LTS version yet, I'm just reverting to 8.1.4 for now.
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.
@coreybutler A small clarification if you don't mind. Why did you have to make changes for npx support? Even with node v8.1
, npx was available and usable, although buggy on windows. But nvm shouldn't have to do anything for this.
Node 8.1 did _not_ ship with npx support. If you have it in 8.1, you must have run npm install -g npm
somewhere along the line to upgrade npm. The npx command was added in npm v5.3.0, and the first version of Node to ship with npm 5.3.0 was 8.2.1. For specific details, see #288.
Yea.. You are probably right. I do remember upgrading npm.
I had the same issue, the solution i have is to:
git clone https://github.com/npm/npm.git
then you should be good
Thank you @michaelkdh It works for me. 馃憤
Slightly different thing was that when I cloned the 'npm.git' it created 'npm' folder. And I had to move the 'npm' folder to 'node_modules'.
@gblue1223 same thing, just need npm in place. cheers,
@coreybutler According to the issue you linked you can override the paths to install to.
If you install latest (1.1.6) and instead of C:/Users/<username>/AppData/Roaming/nvm
you select C:/nvm
as the installation folder, it should work. I had no problem installing 8.4.0
:)
For me, using nvm root
to change the path of nvm
did not work, I got weird error messages. It did not copy nvm <commands>
and then even node
stopped working.
Manually cloning npm
as @michaelkdh suggested did also not work, and seems hackish compared to a clean installation
@peterbakonyi05 It's still hackish to redefine the nvm folder just to install it too.
@Sieabah I agree, the whole problem is weird. However I think it is still better than the other 2 proposed solutions (actually none of them worked for me)
For those still running into this, could someone provide steps for recreating this error? Or perhaps a screencast? I have yet to actually see this in action.
Also, I've noticed alot of people are copy/pasting from their terminals... and the syntax like /c/whatever
, lambdas, etc keep showing up.... all of which indicate people are using things like Cygwin, git shells, cmder, etc. Please note that these shells _do not always adhere to the Windows platform standards_, and they _do_ affect how paths are read. There are several other issues citing this, so try everything in a standard terminal before posting to make sure it's an NVM4W issue and not a terminal-shell issue.
@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\AppDataRoamingnvm\temp
Downloading npm version 5.3.0... Complete
Installing npm v5.3.0...2017/09/05 16:50:14 mkdir C:\Users\Christopher\AppDataRoamingnvm\tempnvm-npmnpm-5.3.0node_modules\libnpxnode_modules\yargsnode_modules\read-pkg-upnode_modules\read-pkgnode_modules\load-json-filenode_modules\parse-jsonnode_modules\error-exnode_modules\is-arrayish: The filename or extension is too long.
C:\Users\Christopher>where nvm
C:\Users\Christopher\AppDataRoamingnvmnvm.exe
C:\Users\Christopher>nvm install 8.4.0
Downloading node.js version 8.4.0 (64-bit)...
Complete
Creating C:\Users\Christopher\AppDataRoamingnvm\temp
Downloading npm version 5.3.0... Complete
Installing npm v5.3.0...2017/09/05 16:50:14 mkdir C:\Users\Christopher\AppDataRoamingnvm\tempnvm-npmnpm-5.3.0node_modules\libnpxnode_modules\yargsnode_modules\read-pkg-upnode_modules\read-pkgnode_modules\load-json-filenode_modules\parse-jsonnode_modules\error-exnode_modules\is-arrayish: The filename or extension is too long.
C:\Users\Christopher>where node
C:\Program Filesnodejsnode.exe
C:\Users\Christopher>where npm
C:\Program Filesnodejsnpm
C:\Program Filesnodejsnpm.cmd
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.
Thanks @computerquip-streamlabs. I got this problem and solved by upgrading nvm with,
scoop install [email protected]
And then I could install node 8.7.0 with nvm.
Installing nvm 1.1.6 fix bug with "npm installing: The filename or extension is too long"
From: C:\Users\[username]\AppDataRoamingnvm
root: C:\nvm
path: C:\Program Files\nodejs
arch: 64
proxy: none
elevate.cmd
and elevate.vbs
to: C:nvmThen it worked for me!
Reopening since several users are still running into this.
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.
Most helpful comment
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 installation