3

进入 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. 我在这里做错了什么?

谢谢。

4

1 回答 1

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

您还没有安装编译所需的基本东西。在 Debian 和 Ubuntu 上,这应该可以解决它:

sudo apt-get install build-essential

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

于 2012-01-13T20:14:11.737 回答