我尝试使用 npm install jquery
进行安装,但在安装其依赖之一 Contextify 时失败了。所以我尝试使用 npm install contextify
,但是出现了以下错误。我已经在网上寻找了大约一个小时左右,但仍然没有找到解决方案。我离成功越来越近,但还不够接近。我的 node.js 运行在 Ubuntu 12.04 上,并且如您在我的代码中所看到的,node.js 版本为 0.8.11。在尝试使用 npm install jquery
时出现了以下错误:
gyp http GET http://nodejs.org/dist/v0.8.11/node-v0.8.11.tar.gz
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: socket hang up
gyp ERR! stack at createHangUpError (http.js:1263:15)
gyp ERR! stack at Socket.socketOnEnd (http.js:1351:23)
gyp ERR! stack at TCP.onread (net.js:418:26)
gyp ERR! System Linux 3.2.0-23-generic
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /opt/www/novacruisers/node_modules/jquery/node_modules/jsdom/node_modules/contextify
gyp ERR! node -v v0.8.11
gyp ERR! node-gyp -v v0.6.11
gyp ERR! not ok
npm WARN optional dep failed, continuing contextify@0.1.3
执行npm install contextify
时出现的错误:
npm ERR! contextify@0.1.3 install: `node-gyp rebuild`
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 1
非常感谢任何帮助. :)
更新
我已经阅读过,如果未安装Python或未安装gcc编译器,则会出现问题。我已安装了这两个。我按照这些关于gcc编译器的说明进行操作,并且Ubuntu 12.04附带了Python 2.7。所以我还在继续研究。:)