CNode

求教npm install mongoose 一直在node-gyp.js" rebuild 卡住了怎么破?

问答
Kkhahux发布于12 年前最后回复9 年前13 回复20177 浏览0 收藏

如题

查看回复

回复 (13)

R
Ricardo-Li#1·12 年前

前几天刚被卡过,换个淘宝的npm源试试,或者等网速好点就行了

C
cuidezhu#2·12 年前

npm默认是从国外的网站获取代码包吧,有时候国外网站会阻塞 ,翻*墙后下载就好了

A
alsotang#3·12 年前
引用 Ricardo-Li前几天刚被卡过,换个淘宝的npm源试试,或者等网速好点就行了

@Ricardo-Li 这个问题可能是 node-gyp 的问题,跟网速没关系。我也一直不懂怎么处理这问题,印象中有人重装 node-gyp 然后成功了。

Y
yorkie#4·12 年前

加上 npm install --verbose 看看呗

J
jysperm#5·12 年前

ps awufx, 看看具体卡在哪个命令

K
khahux#6·12 年前
引用 Ricardo-Li前几天刚被卡过,换个淘宝的npm源试试,或者等网速好点就行了

@Ricardo-Li @cuidezhu @alsotang @yorkie @jysperm 问题已经解决,学nodejs没几天,学校万恶校园网linux没客户端,在windows下折腾,昨天查好久应该是没装Windows SDK编译不过去,后来装了Microsoft .NET Framework SDK v2.0 (64bit),把vcbuild.exe加到环境变量后,题目那个错误没了,又报两个错误(error MSB6006: “VCBuild.exe”已退出,代码为 -1 和 Cannot open include file: 'cstdlib':), 安装 npm install node-gyp -g npm install bcrypt -g 均失败 搜搜有人说装vs2012。。。。。。那么大的东东,顿时蛋疼失去折腾windows的勇气,于是放弃windows折腾, 跪求室友给用电脑开wifi(室友最后勉强答应给10K小水管),我也是各种悲伤, 进Linux后一切顺利基本没遇到什么问题,以后有问题再来请教 github均已加关注,谢谢各位了

K
khahux#8·12 年前
引用 alsotang@khahux windows就是蛋疼啊

@alsotang 现在不疼了,谢谢诸位

R
ruanyl#9·12 年前

我也碰到这个问题,虽然问题已解决,这里粘贴一下官方的提示(windows需要装一堆东西lol):

You will also need to install:
On Unix:
	* python (v2.7 recommended, v3.x.x is not supported)
	* make
	* A proper C/C++ compiler toolchain, like GCC
	
On Windows:
	* Python (v2.7.3 recommended, v3.x.x is not supported)
	
	Windows XP/Vista/7:
		* Microsoft Visual Studio C++ 2010 (Express version works well)
		* For 64-bit builds of node and native modules you will also need the Windows 7 64-bit SDK
		* If the install fails, try uninstalling any C++ 2010 x64&x86 Redistributable that you have installed first.
		* If you get errors that the 64-bit compilers are not installed you may also need the compiler update for the Windows SDK 7.1
	
	Windows 7/8:
		* Microsoft Visual Studio C++ 2012 for Windows Desktop (Express version works well)
W
wenqingyu#12·9 年前

遇到同样问题快要奔溃,终于解决 首先删除 $HOME/.node-gyp rm -rf ~/.node-gyp

然后重新安装最新的 node-gyp 包 npm i node-gyp -g

然后移除直接安装但build失败的 nodemodules rm -rf ./project/node_modules

最后重新 npm i -d 就行

最初解决方案出自: https://github.com/nodejs/node-gyp/issues/809

W
wenqingyu#13·9 年前

还有一种情况是文件路径里面有空格,将空格移除即可。

参与回复
登录后即可参与回复。登录