解决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
相关推荐
十字路口的火丁18 小时前
前端开发如何灵活使用 css 变量
前端
_志哥_18 小时前
深度解析:解决 backdrop-filter 与 border-radius 的圆角漏光问题
前端·javascript·html
南囝coding18 小时前
100% 用 AI 做完一个新项目,从 Plan 到 Finished 我学到了这些
前端·后端
qiao若huan喜18 小时前
10、webgl 基本概念 + 坐标系统 + 立方体
前端·javascript·信息可视化·webgl
前端一课18 小时前
Vue3 的 Composition API 和 Options API 有哪些区别?举例说明 Composition API 的优势。
前端
用户479492835691518 小时前
都说node.js是事件驱动的,什么是事件驱动?
前端·node.js
晴殇i18 小时前
前端架构中的中间层设计:构建稳健可维护的组件体系
前端·面试·代码规范
申阳19 小时前
Day 7:05. 基于Nuxt开发博客项目-首页开发
前端·后端·程序员
Crystal32819 小时前
App端用户每日弹出签到弹窗如何实现?(uniapp+Vue)
前端·vue.js
摸着石头过河的石头19 小时前
Service Worker 深度解析:让你的 Web 应用离线也能飞
前端·javascript·性能优化