I know Windows 7 isn't officially supported, but this doesn't feel like a Windows 7 issue.
I'm not sure what it does feel like, but that's what I'm here to find out.
It looks like 'gentle-fs' doesn't want to rm the file it needs to rm.
npm install -g npm
would work.
It didn't:
C:\Users\nannp>npm install -g npm
npm ERR! path C:\Program Files\nodejs\npm.cmd
npm ERR! code EEXIST
npm ERR! Refusing to delete C:\Program Files\nodejs\npm.cmd: is outside C:\Program Files\nodejs\node_modules\npm and not a link
npm ERR! File exists: C:\Program Files\nodejs\npm.cmd
npm ERR! Move it away, and try again.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\nannp\AppData\Roaming\npm-cache\_logs\2018-09-06T13_02_02_287Z-debug.log
The mentioned log file ends with:
3446 verbose unlock done using C:\Users\nannp\AppData\Roaming\npm-cache\_locks\staging-dfd8fbf9c1feea0f.lock for C:\Program Files\nodejs\node_modules\.staging
3447 verbose stack Error: Refusing to delete C:\Program Files\nodejs\npm.cmd: is outside C:\Program Files\nodejs\node_modules\npm and not a link
3447 verbose stack at clobberFail (C:\Users\nannp\AppData\Roaming\nvm\v8.10.0\node_modules\npm\node_modules\gentle-fs\lib\rm.js:121:12)
3447 verbose stack at isSafeToRm (C:\Users\nannp\AppData\Roaming\nvm\v8.10.0\node_modules\npm\node_modules\gentle-fs\lib\rm.js:114:15)
3447 verbose stack at C:\Users\nannp\AppData\Roaming\nvm\v8.10.0\node_modules\npm\node_modules\gentle-fs\lib\rm.js:54:5
3447 verbose stack at LOOP (C:\Users\nannp\AppData\Roaming\nvm\v8.10.0\node_modules\npm\node_modules\slide\lib\chain.js:7:26)
3447 verbose stack at C:\Users\nannp\AppData\Roaming\nvm\v8.10.0\node_modules\npm\node_modules\slide\lib\chain.js:18:7
3447 verbose stack at C:\Users\nannp\AppData\Roaming\nvm\v8.10.0\node_modules\npm\node_modules\gentle-fs\lib\rm.js:180:7
3447 verbose stack at C:\Users\nannp\AppData\Roaming\nvm\v8.10.0\node_modules\npm\node_modules\iferr\index.js:13:50
3447 verbose stack at _readAllLinks (C:\Users\nannp\AppData\Roaming\nvm\v8.10.0\node_modules\npm\node_modules\gentle-fs\lib\rm.js:215:28)
3447 verbose stack at C:\Users\nannp\AppData\Roaming\nvm\v8.10.0\node_modules\npm\node_modules\iferr\index.js:13:50
3447 verbose stack at resolveSymlink (C:\Users\nannp\AppData\Roaming\nvm\v8.10.0\node_modules\npm\node_modules\gentle-fs\lib\rm.js:226:22)
3447 verbose stack at _readAllLinks (C:\Users\nannp\AppData\Roaming\nvm\v8.10.0\node_modules\npm\node_modules\gentle-fs\lib\rm.js:217:5)
3447 verbose stack at readAllLinks (C:\Users\nannp\AppData\Roaming\nvm\v8.10.0\node_modules\npm\node_modules\gentle-fs\lib\rm.js:212:3)
3447 verbose stack at C:\Users\nannp\AppData\Roaming\nvm\v8.10.0\node_modules\npm\node_modules\gentle-fs\lib\rm.js:179:5
3447 verbose stack at C:\Users\nannp\AppData\Roaming\nvm\v8.10.0\node_modules\npm\node_modules\iferr\index.js:13:50
3447 verbose stack at cb (C:\Users\nannp\AppData\Roaming\nvm\v8.10.0\node_modules\npm\node_modules\slide\lib\async-map.js:47:24)
3447 verbose stack at C:\Users\nannp\AppData\Roaming\nvm\v8.10.0\node_modules\npm\node_modules\gentle-fs\lib\rm.js:153:16
3448 verbose cwd C:\Users\nannp\
3449 verbose Windows_NT 6.1.7601
3450 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "npm"
3451 verbose node v8.10.0
3452 verbose npm v5.6.0
3453 error path C:\Program Files\nodejs\npm.cmd
3454 error code EEXIST
3455 error Refusing to delete C:\Program Files\nodejs\npm.cmd: is outside C:\Program Files\nodejs\node_modules\npm and not a link
3456 error File exists: C:\Program Files\nodejs\npm.cmd
3457 error Move it away, and try again.
3458 verbose exit [ 1, true ]
Moving 'npm.cmd' away doesn't really help. Then I can't run npm at all.
Did a fresh install of nvm on Windows 7, via the installer. Accept all defaults.
Opened a new CMD window. Ran:
nvm install 8.10
npm install -g npm
Sorry - My searching skills failed me today...
After submitting, I did a bit more Googling and found the other thread: https://github.com/coreybutler/nvm-windows/issues/300
Thanks to @Jeff-Lewis for this simple gem:
Since this IS a Windows problem, save and run the commands below in a .bat file:
OR MAYBE RUN THE COMMANDS MANUALLY ONE AT A TIME, since if one step fails, the following steps could go from bad to worse...
pushd %ProgramFiles%\nodejs
del npm npm.cmd
move node_modules\npm node_modules\npm2
call node node_modules\npm2\bin\npm-cli.js i npm@latest -g
rmdir /S /Q node_modules\npm2
popd
pause
Worked perfectly to get npm to V6.4.1
Anyone else feel like this npm world is a house of cards at times???
Most helpful comment
Sorry - My searching skills failed me today...
After submitting, I did a bit more Googling and found the other thread: https://github.com/coreybutler/nvm-windows/issues/300
Thanks to @Jeff-Lewis for this simple gem:
Since this IS a Windows problem, save and run the commands below in a .bat file:
OR MAYBE RUN THE COMMANDS MANUALLY ONE AT A TIME, since if one step fails, the following steps could go from bad to worse...
Worked perfectly to get npm to V6.4.1
Anyone else feel like this npm world is a house of cards at times???