首页 > win8安装grunt,执行npm install时报错

win8安装grunt,执行npm install时报错

想在本机上装Bootstrap的源码,需要安装Grunt。
按照官网的表述,在执行npm install时,出现了很多报错。
希望有人指点一下是什么原因?还要装其他的环境吗?
以下为命令行:

F:\Office software2\bootstrap-3.2.0>npm install
npm WARN deprecated grunt-jscs-checker@0.6.2: Package was renamed to 'grunt-jscs
'
npm WARN package.json github-url-from-git@1.1.1 No repository field.
\

phantomjs@1.9.10 install F:\Office software2\bootstrap-3.2.0\node_modules\grun
t-contrib-qunit\node_modules\grunt-lib-phantomjs\node_modules\phantomjs
node install.js

Downloading https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-wind
ows.zip
Saving to C:\Users\博闻\AppData\Local\Temp\phantomjs\phantomjs-1.9.7-windows.zip

Receiving...

Error making request.
Error: connect ETIMEDOUT
at errnoException (net.js:904:11)
at Object.afterConnect [as oncomplete] (net.js:895:19)

Please report this full log at https://github.com/Medium/phantomjs

npm ERR! phantomjs@1.9.10 install: node install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the phantomjs@1.9.10 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.
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "F:\Office software2\Node.js\\node.exe" "F:\Office softwar
e2\Node.js\node_modules\npm\bin\npm-cli.js" "install"
npm ERR! cwd F:\Office software2\bootstrap-3.2.0
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0


问题分析

单纯的就是phantomjs安装出错,这个错误我经常遇到(能遇到用yeoman的同学真是很开心的事情)

你注意它这两句log:

Downloading https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-windows.zip
Saving to C:\Users\博闻\AppData\Local\Temp\phantomjs\phantomjs-1.9.7-windows.zip
Receiving...

正常的安装过程这里是会出现下载的百分比的,然后一点一点向前推进到100%,如果直接出Err就是这里下载失败

处理方案

处理这个问题很简单,手动去下载phantomjs-1.9.7-windows.zip(关于如何手动下载,这个百度或者Google一下)

然后把它手动的放到C:\Users\博闻\AppData\Local\Temp\phantomjs\目录下,然后你在运行一下npm install就可以了

其实说个题外话,phantomjs多用在测试上的,对你build或者serve应该是没有妨碍的,即使出错的也可以使用这两个功能


首先安装Bootstrap的源码跟grunt没有关系,Bootstrap的源码安装了node环境就可以了。

grunt是一个构建工具,Bootstrap项目也是采用这个grunt构建工具。当然你不用构建工具,对于你使用Bootstrap没有多大关系。

npm install命令执行时,他会在package.json安装依赖包。从错误信息来看,很有可能是phantomjs相关的依赖出错(我也遇到过,这个工具好像是做js自动话测试的吧)。错误的原因好像是网络问题(你懂得)。

解决方法。使用别的同性质来代替或者忽略这个依赖安装。希望能帮到你

【热门文章】
【热门文章】