使用的ubuntu 64位系统,node版本是0.11.10 -pre npm 版本是1.3.15
root@imeitu:~# npm install --nodedir=/root/node_modules jquery npm http GET https://registry.npmjs.org/jquery npm http 304 https://registry.npmjs.org/jquery npm http GET https://registry.npmjs.org/htmlparser/1.7.6 npm http GET https://registry.npmjs.org/xmlhttprequest npm http GET https://registry.npmjs.org/location/0.0.1 npm http GET https://registry.npmjs.org/navigator npm http GET https://registry.npmjs.org/contextify npm http GET https://registry.npmjs.org/jsdom npm http 304 https://registry.npmjs.org/location/0.0.1 npm http 304 https://registry.npmjs.org/navigator npm http 304 https://registry.npmjs.org/jsdom npm http 304 https://registry.npmjs.org/contextify npm http 304 https://registry.npmjs.org/xmlhttprequest npm http 304 https://registry.npmjs.org/htmlparser/1.7.6
contextify@0.1.6 install /root/node_modules/jquery/node_modules/contextify node-gyp rebuild
gyp: /root/node_modules/common.gypi not found (cwd: /root/node_modules/jquery/node_modules/contextify) while reading includes of binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: gyp
failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:337:16)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:101:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:862:12)
gyp ERR! System Linux 3.8.0-29-generic
gyp ERR! command “node” “/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js” "rebuild"
gyp ERR! cwd /root/node_modules/jquery/node_modules/contextify
gyp ERR! node -v v0.11.10-pre
gyp ERR! node-gyp -v v0.12.1
gyp ERR! not ok
npm http GET https://registry.npmjs.org/cssom
npm ERR! contextify@0.1.6 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the contextify@0.1.6 install script.
npm ERR! This is most likely a problem with the contextify package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls contextify
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.8.0-29-generic npm ERR! command “/usr/local/bin/node” “/usr/local/bin/npm” “install” “–nodedir=/root/node_modules” "jquery" npm ERR! cwd /root npm ERR! node -v v0.11.10-pre npm ERR! npm -v 1.3.15 npm ERR! code ELIFECYCLE npm http 304 https://registry.npmjs.org/cssom npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /root/npm-debug.log npm ERR! not ok code 0
还是有错误
楼主解决了么,我也遇到类似问题了
用 cheerio 代替。