解决:前端npm install 报错PhantomJS not found on PATH与electron问题
报错:
npm ERR! code 1
npm ERR! path D:\aaaa\node_modules\phantomjs-prebuilt
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node install.js
npm ERR! PhantomJS not found on PATH
解决:
第一步:
把node_modules删掉,重新开始npm install,发现报错npm ERR! PhantomJS not found on PATH
第二步:
npm install phantomjs@2.1.1 --ignore-scripts
第三步:
npm install
第四步:
发现报错:Error: Electron failed to install correctly, please delete node_modules/electron and try installing again;删除 node_modules/electron 里后npm install仍然报错;
重头再来,参照https://ezrayes.com/index.php/archives/217/文章确定是否是electron问题;
第一步:
把node_modules删掉,重新开始npm install,发现之前的报错npm ERR! PhantomJS not found on PATH
第二步:
使用命令:npm config edit 打开文件
因为electron的安装并不依赖本地npm中registry所配置的镜像,需要增加名称为electron_mirror的镜像源,修改~/.npmrc,添加electron_mirror=https://npm.taobao.org/mirrors/electron/即可。
emmm…
重新拉取项目后莫名就好了????
这里多了一行electron_mirror=https://npm.taobao.org/mirrors/electron/????
这里文件之前多加一行为什么新拉取后没还原呢,奇奇怪怪bug