aaronpowell / ps-nvm

PowerShell module for managing multiple Node.js versions
MIT License
127 stars 26 forks source link

Running npm install via npm-check fails. #84

Closed jacobrillema closed 5 years ago

jacobrillema commented 5 years ago

While trying to update npm via npm-check I get the follow error. I suspect it is not related to npm-check as the simple npm install command is given below.

$ npm install --global npm@6.10.2 --color=always

Command failed: C:\WINDOWS\system32\cmd.exe /s /c "npm "install" "--global" "npm@6.10.2" "--color=always"" npm ERR! path C:\Node.nvm\v12.6.0\npm.cmd npm ERR! code EEXIST npm ERR! Refusing to delete C:\Node.nvm\v12.6.0\npm.cmd: is outside C:\Node.nvm\v12.6.0\node_modules\npm and not a link
npm ERR! File exists: C:\Node.nvm\v12.6.0\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\jacob\AppData\Roaming\npm-cache_logs\2019-08-05T13_47_15_598Z-debug.log
(node:11372) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Error: ENOENT: no such file or directory, open 'child_process.js' at Object.openSync (fs.js:447:3) at Object.readFileSync (fs.js:349:35) at CallsiteRecord.renderSync (C:\Node.nvm\v12.6.0\node_modules\npm-check\node_modules\callsite-record\lib\index.js:214:26) at C:\Node.nvm\v12.6.0\node_modules\npm-check\lib\cli.js:127:51 at processTicksAndRejections (internal/process/task_queues.js:85:5)

jacobrillema commented 5 years ago

The more I look into this it is more of a Windows issue, not ps-nvm. Here is the recommended approach on updating NPM on windows

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

I will close this issue out.