NPM和jsdom错误加载

时间:2012-01-13 18:49:08

标签: node.js npm jsdom

进入node.js的世界。基本上刚开始。我安装了节点并完成了一些工作。根据我的理解,我需要安装模块jsdom以使jQuery正常工作。所以我下载并编译了NPM,当我运行npm install jsdom命令时,我收到了大量的错误。这是打印输出:

npm WARN htmlparser@1.7.3 package.json: bugs['web'] should probably be bugs['url']

> contextify@0.0.7 preinstall /usr/lib/nodejs/npm/node_modules/jsdom/node_modules/contextify
> node-waf clean || true; node-waf configure build

Nothing to clean (project not configured)
Setting srcdir to                        : /usr/lib/nodejs/npm/node_modules/jsdom/node_modules/contextify 
Setting blddir to                        : /usr/lib/nodejs/npm/node_modules/jsdom/node_modules/contextify/build 
Checking for program g++ or c++          : not found 
Checking for program icpc                : not found 
Checking for program c++                 : not found 
/usr/lib/nodejs/npm/node_modules/jsdom/node_modules/contextify/wscript:11: error: could not configure a cxx compiler!
npm ERR! error installing contextify@0.0.7 Error: contextify@0.0.7 preinstall: `node-waf clean || true; node-waf configure build`
npm ERR! error installing contextify@0.0.7 `sh "-c" "node-waf clean || true; node-waf configure build"` failed with 1
npm ERR! error installing contextify@0.0.7     at ChildProcess.<anonymous> (/usr/lib/nodejs/npm/lib/utils/exec.js:49:20)
npm ERR! error installing contextify@0.0.7     at ChildProcess.emit (events.js:70:17)
npm ERR! error installing contextify@0.0.7     at maybeExit (child_process.js:359:16)
npm ERR! error installing contextify@0.0.7     at Process.onexit (child_process.js:395:5)
npm ERR! error installing jsdom@0.2.10 Error: contextify@0.0.7 preinstall: `node-waf clean || true; node-waf configure build`
npm ERR! error installing jsdom@0.2.10 `sh "-c" "node-waf clean || true; node-waf configure build"` failed with 1
npm ERR! error installing jsdom@0.2.10     at ChildProcess.<anonymous> (/usr/lib/nodejs/npm/lib/utils/exec.js:49:20)
npm ERR! error installing jsdom@0.2.10     at ChildProcess.emit (events.js:70:17)
npm ERR! error installing jsdom@0.2.10     at maybeExit (child_process.js:359:16)
npm ERR! error installing jsdom@0.2.10     at Process.onexit (child_process.js:395:5)
npm ERR! contextify@0.0.7 preinstall: `node-waf clean || true; node-waf configure build`
npm ERR! `sh "-c" "node-waf clean || true; node-waf configure build"` failed with 1
npm ERR! 
npm ERR! Failed at the contextify@0.0.7 preinstall 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-waf clean || true; node-waf configure build
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! 
npm ERR! System Linux 2.6.35-27-virtual
npm ERR! command "node" "/usr/bin/npm" "install" "jsdom"
npm ERR! cwd /usr/lib/nodejs/npm/node_modules
npm ERR! node -v v0.6.2
npm ERR! npm -v 1.0.105
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /usr/lib/nodejs/npm/node_modules/npm-debug.log
npm not ok

显然没有用。

  1. 我是否需要这个包来执行jQuery?
  2. 我在这里做错了什么?
  3. 感谢。

1 个答案:

答案 0 :(得分:1)

Checking for program g++ or c++          : not found

您尚未安装编译所需的基本内容。在Debian和Ubuntu上,这应该解决它:

sudo apt-get install build-essential

对于其他发行版,命令有些不同,但基本原理是相同的。