npm err often occurs when npm installs global packages! Problems with File exists: XXX, for example:
xiaotaos-MacBook-Pro:nodeAPILearn hh$ sudo npm install -g node-inspector
npm ERR! path /usr/local/lib/node_modules/node-inspector/node_modules/v8-profiler/node_modules/node-pre-gyp/node_modules/request/node_modules/http-signature/node_modules/.bin/sshpk-sign
npm ERR! code EEXIST
npm ERR! Refusing to delete /usr/local/lib/node_modules/node-inspector/node_modules/v8-profiler/node_modules/node-pre-gyp/node_modules/request/node_modules/http-signature/node_modules/.bin/sshpk-sign: containing path /usr/local/lib/node_modules/node-inspector/node_modules/v8-profiler/node_modules/node-pre-gyp/node_modules/request/node_modules/http-signature/node_modules/sshpk isn"t under npm"s control
npm ERR! File exists: /usr/local/lib/node_modules/node-inspector/node_modules/v8-profiler/node_modules/node-pre-gyp/node_modules/request/node_modules/http-signature/node_modules/.bin/sshpk-sign
npm ERR! Move it away, and try again.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/hh/.npm/_logs/2018-05-26T05_57_19_766Z-debug.log
in general, I can delete this file manually at this time, but the problem is that there is another one after deleting one. Sometimes I can delete it two or three times, but sometimes I need to delete it many times.
I don"t think deleting conflicting files at a time is a convenient solution, so here I would like to ask you: have you ever encountered this situation, and how do you solve it?