今天执行
electron .
时候报了,electron安装不正确,需要重新安装。
所以执行了下面这个命令:
npm install -g electron
然后呢,就报了这个错:
npm ERR! code EEXIST npm ERR! path C:\Users\admin\AppData\Roaming\npm\node_modules\electron\cli.js npm ERR! dest C:\Users\admin\AppData\Roaming\npm\electron npm ERR! EEXIST: file already exists, cmd shim 'C:\Users\admin\AppData\Roaming\npm\node_modules\electron\cli.js' -> 'C:\Users\admin\AppData\Roaming\npm\electron' npm ERR! File exists: C:\Users\admin\AppData\Roaming\npm\electron 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! C:\Users\admin\AppData\Roaming\npm-cache\_logs\2020-01-30T02_33_08_367Z-debug.log
于是乎:
我按照错误提示删除了:
del /s /q C:\Users\admin\AppData\Roaming\npm\electron
然后我又继续
npm install -g electron
继续报错:
npm ERR! code EEXIST npm ERR! path C:\Users\admin\AppData\Roaming\npm\node_modules\electron\cli.js npm ERR! dest C:\Users\admin\AppData\Roaming\npm\electron.ps1 npm ERR! EEXIST: file already exists, cmd shim 'C:\Users\admin\AppData\Roaming\npm\node_modules\electron\cli.js' -> 'C:\Users\admin\AppData\Roaming\npm\electron.ps1' npm ERR! File exists: C:\Users\admin\AppData\Roaming\npm\electron.ps1 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! C:\Users\admin\AppData\Roaming\npm-cache\_logs\2020-01-30T02_35_39_451Z-debug.log
看来还有electron残存文件啊。于是我加上了通配符
del /s /q C:\Users\admin\AppData\Roaming\npm\electron*
删除后 继续安装
终于成功了。万岁!!!!
原创申明:本文章为三叔原创。