首页 > 开发 > NodeJS > 正文

用 npm install -g karma 安装 Karma 报错:events.js:72 throw er

2017-09-08 17:34:24  来源:网友分享

安装 Karma

npm install -g karma

进行到下面这步的时候,报错了:

> phantomjs@1.9.7-1 install /usr/local/share/npm/lib/node_modules/karma-phantomjs-launcher/node_modules/phantomjs> node install.jsDownloading http://cdn.bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-macosx.zipSaving to /var/folders/gv/f4rk8mb942z6z4w712q7w9r00000gn/T/phantomjs/phantomjs-1.9.7-macosx.zipevents.js:72        throw er; // Unhandled 'error' event              ^Error: connect ETIMEDOUT    at errnoException (net.js:901:11)    at Object.afterConnect [as oncomplete] (net.js:892:19)npm ERR! weird error 8npm ERR! not ok code 0

解决方案

遇到同样的错误,确实是因为网站被墙导致的连接超时,用VPN代理后一切正常