报错::PhantomJS not found on PATH与electron

解决:前端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

在这里插入图片描述

  • 12
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值