天天看点

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

继续阅读