解决vue-cli安装错误(npm ERR! A complete log of this run can be found in npm ERR!)

使用npm安装vue-cli错误:npm install –g vue-cli,错误信息如下:

解决vue-cli安装错误(npm ERR! A complete log of this run can be found in npm ERR!)

文章图片
npm ERR! path C:\Users\Promo\AppData\Roaming\npm\node_modules\vue-cli\node_modules\nan\package.json npm ERR! code EPERM npm ERR! errno -4048 npm ERR! syscall unlink npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\Promo\AppData\Roaming\npm\node_modules\vue-cli\node_modules\nan\package.json' npm ERR! at Error (native) npm ERR! { Error: EPERM: operation not permitted, unlink 'C:\Users\Promo\AppData\Roaming\npm\node_modules\vue-cli\node_modules\nan\package.json' npm ERR! at Error (native) npm ERR! stack: 'Error: EPERM: operation not permitted, unlink \'C:\Users\Promo\AppData\Roaming\npm\node_modules\vue-cli\node_modules\nan\package.json\'\n at Error (native)', npm ERR! errno: -4048, npm ERR! code: 'EPERM', npm ERR! syscall: 'unlink', npm ERR! path: 'C:\Users\Promo\AppData\Roaming\npm\node_modules\vue-cli\node_modules\nan\package.json' } npm ERR! npm ERR! Please try running this command again as root/Promo.npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Promo\AppData\Roaming\npm-cache_logs\2017-09-10T06_15_03_457Z-debug.log

参考解决办法如下:
1、进入文件夹C:\Users\Promo\AppData\Roaming\npm\node_modules,在windows中确保已启用所有文件。
2、删除@vue和vue-cli文件。
3、在cmd中切换用户为Administrator。
【解决vue-cli安装错误(npm ERR! A complete log of this run can be found in npm ERR!)】4、使用npm install @vue/cli –g

    推荐阅读