解决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
相关推荐
赖龙3 小时前
pnpm vs npm
前端·npm·node.js
学如逆水,不进则退4 小时前
在线免费音频剪辑:NBTools 可视化波形裁剪 MP3/WAV,本地处理免上传
前端·音视频
Mh4 小时前
虚拟滚动真的比普通滚动性能更好吗?
前端·javascript·性能优化
pe7er5 小时前
React + Ant Design 中的 IME (输入法合成)安全输入组件
前端
Super 含5 小时前
Android 启动优化(二):TTID、TTFD 与 Macrobenchmark 启动性能测量
前端
Python私教5 小时前
别急着加 llms.txt:企业官网面向 AI 搜索的工程清单
前端·人工智能·seo
东方小月6 小时前
从零开发一个 Coding Agent(十三):实现安全的 read 文件读取工具
前端·人工智能·全栈
东方小月6 小时前
从零开发一个 Coding Agent(十二):实现版本化 JSONL 与真实 CLI 入口
前端·设计模式·前端框架
FL16238631297 小时前
室内易燃物识别易燃评估室内易燃程度识别分割数据集labelme格式1015张85类别
java·服务器·前端
用户059540174467 小时前
把 AI 长期记忆去重测试从 20 分钟压到 40 秒,重复率从 18% 干到 1.5%
前端·css