npm install error在phantomjs@1.9.12安装脚本失败

use*_*837 7 npm

我在尝试进行npm安装时收到此错误...我已经被这个问题困扰了4天...请有人帮助我...

npm ERR! Windows_NT 6.1.7601  
npm ERR! argv "c:\\Program Files\\nodejs\\node.exe" "c:\\Users\\Username\\AppData\\Roaming\\npm\\node_modules\\n pm\\bin\\npm-cli.js" "install" 
npm ERR! node v0.10.33  
npm ERR! npm  v2.1.5  
npm ERR! code ELIFECYCLE  
npm ERR! errno ENOENT  
npm ERR! syscall spawn

npm ERR! phantomjs@1.9.12 install: `node install.js`  
npm ERR! spawn ENOENT  
npm ERR! 
npm ERR! Failed at the phantomjs@1.9.12 install script.  
npm ERR! This is most likely a problem with the phantomjs package,  
npm ERR! not with npm itself.  
npm ERR! Tell the author that this fails on your system:  
npm ERR!     node install.js  
npm ERR! You can get their info via:  
npm ERR!     npm owner ls phantomjs 
npm ERR! There is likely additional logging output above.
Run Code Online (Sandbox Code Playgroud)

小智 5

我在Windows上遇到了完全相同的问题.为了解决这个问题,我采取了以下步骤:

  1. 通过下载和解压缩在本地安装最新版本的phantomjs(目前,phantomjs-1.9.8-windows).我有一个与phantomjs npm包不兼容的旧版本.
  2. 更新环境变量以指向phantomjs.exe(PHANTOMJS_HOME)的最新版本.
  3. 退出并重新启动Windows提示符或shell以识别变量.
  4. 现在,npm install或者具体来说,npm install phantomjs@1.9.12应该正常工作.

您可以使用where phantomjsphantomjs -v从git bash shell或命令提示符测试本地phantomjs可执行安装.