出錯如下圖
You can tell NPM and the PhantomJS installer to skip validation of ssl keys with NPM's strict-ssl setting:
npm set strict-ssl false
WARNING: Turning off strict-ssl
leaves you vulnerable to attackers reading your encrypted traffic, so run this at your own risk!
還有一種情況是被牆了
報錯如下:
npm ERR! Exit status 8
解决办法就是手动下载phantomjs-1.9.7-windows.zip
,复制到C:\Users\用戶名~1\AppData\Local\Temp\phantomjs\
目录,再次执行npm install
,安装成功,如下:
下载phantomjs-1.9.7-windows.zip
必须挂代理或者VPN,比较麻烦,大家可以从网盘下载,里面包括各种系统下的版本。