天天看點

npm ERR! code EEXIST(檔案存在/檔案拒絕delete)問題解決

問題

在使用npm安裝插件的時候,彈出了以下的錯誤

(File exists和 Refusing to delete)
$ npm install -g truffle
npm ERR! code EEXIST
npm ERR! path E:\software\nn\node.js\node_global\node_modules\truffle\build\cli.bundled.js
npm ERR! dest E:\software\nn\node.js\node_global\truffle
npm ERR! EEXIST: file already exists, cmd shim 'E:\software\nn\node.js\node_global\node_modules\truffle\build\cli.bundled.js' -> 'E:\software\nn\node.js\node_global\truffle'
npm ERR! File exists: E:\software\nn\node.js\node_global\truffle
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
 
npm ERR! A complete log of this run can be found in:
npm ERR!     E:\software\nn\node.js\node_cache\_logs\2020-02-07T07_24_49_045Z-debug.log
           

解決方案

  • 嘗試運作npm update -g npm然後再次運作npm i。
  • 如果這不起作用,npm cache clean可能有幫助。
  • 如果這不起作用,您應該考慮删除應用程式中的node_modules檔案夾并再次運作npm install。

轉載于https://blog.csdn.net/weixin_45969777/article/details/107062837

繼續閱讀