解决npm安装phantomjs失败

失败信息

shell 复制代码
Progress: resolved 102, reused 102, downloaded 0, added 0, done
.pnpm/phantomjs@2.1.7/node_modules/phantomjs: Running install script, failed in 21.3s
.../node_modules/phantomjs install$ node install.js
│ PhantomJS not found on PATH
│ Downloading https://github.com/Medium/phantomjs/releases/download/v2.1.1//phantomjs-2.1.1-windows.zip
│ Saving to C:\Users\12259\AppData\Local\Temp\phantomjs\phantomjs-2.1.1-windows.zip
│ Receiving...
│ Error making request.
│ Error: connect ETIMEDOUT 20.205.243.166:443
│     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
│ Please report this full log at https://github.com/Medium/phantomjs
└─ Failed in 21.3s at D:\software\pnpmnode\pnpm-global\5\.pnpm\phantomjs@2.1.7\node_modules\phantomjs
 ELIFECYCLE  Command failed with exit code 1.
PS C:\Users\12259> pnpm config get registry
http://registry.npm.taobao.org/
PS C:\Users\12259> pnpm config get registry^C
PS C:\Users\12259> ^C
PS C:\Users\12259> ^C
PS C:\Users\12259> pnpm config set registry https://registry.npmmirror.com
PS C:\Users\12259> pnpm config get registry
https://registry.npmmirror.com/
PS C:\Users\12259> pnpm install -g phantomjs
 WARN  deprecated phantomjs@2.1.7: Package renamed to phantomjs-prebuilt. Please update 'phantomjs' package references to 'phantomjs-prebuilt'
 WARN  10 deprecated subdependencies found: boom@2.10.1, cryptiles@2.0.5, har-validator@2.0.6, hawk@3.1.3, hoek@2.16.3, mkdirp@0.5.0, node-uuid@1.4.8, request@2.67.0, sntp@1.0.9, tough-cookie@2.2.2
Packages: +102

原因:

下载https://github.com/Medium/phantomjs/releases/download/v2.1.1//phantomjs-2.1.1-windows.zip失败了。

但是到github上也没有这个文件了

解决方法

https://phantomjs.org/download.html 下载对应的文件

将压缩文件放到上面要求的Saving to 的地址,比如我是

C:\Users\12259\AppData\Local\Temp\phantomjs\phantomjs-2.1.1-windows.zip

之后重新运行安装phantomjs的命令,比如我是全局安装

shell 复制代码
npm install -g phantomjs
相关推荐
贵沫末8 分钟前
React——基础
前端·react.js·前端框架
aklry19 分钟前
uniapp三步完成一维码的生成
前端·vue.js
Rubin9327 分钟前
判断元素在可视区域?用于滚动加载,数据埋点等
前端
爱学习的茄子27 分钟前
AI驱动的单词学习应用:从图片识别到语音合成的完整实现
前端·深度学习·react.js
用户38022585982428 分钟前
使用three.js实现3D地球
前端·three.js
程序无bug30 分钟前
Spring 面向切面编程AOP 详细讲解
java·前端
zhanshuo30 分钟前
鸿蒙UI开发全解:JS与Java双引擎实战指南
前端·javascript·harmonyos
撰卢1 小时前
如何提高网站加载速度速度
前端·javascript·css·html
10年前端老司机1 小时前
在React项目中如何封装一个可扩展,复用性强的组件
前端·javascript·react.js
Struggler2811 小时前
解决setTimeout/setInterval计时不准确问题的方案
前端