解决npm安装phantomjs失败

失败信息

Progress: resolved 102, reused 102, downloaded 0, added 0, done
.pnpm/[email protected]/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\[email protected]\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 [email protected]: Package renamed to phantomjs-prebuilt. Please update 'phantomjs' package references to 'phantomjs-prebuilt'
 WARN  10 deprecated subdependencies found: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Packages: +102

原因:

下载https://github.com/Medium/phantomjs/releases/download/v2.1.1//phantomjs-2.1.1-windows.zip失败了。
但是到github上也没有这个文件了

解决方法

到 https://phantomjs.org/download.html 下载对应的文件
解决npm安装phantomjs失败_第1张图片

将压缩文件放到上面要求的Saving to 的地址,比如我是
C:\Users\12259\AppData\Local\Temp\phantomjs\phantomjs-2.1.1-windows.zip
之后重新运行安装phantomjs的命令,比如我是全局安装

npm install -g phantomjs

你可能感兴趣的:(npm,前端,node.js)