본문 바로가기

카테고리 없음

[npm] Refusing to delete C:\Program Files\nodejs\npm.cmd: is outside C:\Program Files\nodejs\node_modules\npm and not a link

npm 업그레이드시, 

npm ERR! code EEXIST
npm ERR! path C:\Program Files\nodejs\npm.cmd
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! with --force to overwrite files recklessly.

npm ERR! A complete log of this run can be found in:

 

 

보통 chocolatey를 통해 nvm을 설치하면 나타나는 에러로 

npm이 시스템에 이미 있는 파일을 덮어쓸 수 없기 때문에

아래와 같이 처리해야한다.

cd %APPDATA%\nvm\{사용하고 있는 버전 아무거나}
move npm npm-old
move npm.cmd npm-old.cmd
move npx npx-old
move npx.cmd npx-old.cmd
cd node_modules\
move npm npm-old
cd npm-old\bin
node npm-cli.js i -g npm@latest --force
반응형