2012-01-13 70 views
3

進入node.js的世界。基本剛剛開始。我已經安裝了節點並獲得了一些工作。從我的理解,我需要安裝模塊jsdom讓jQuery工作。所以我下載並編譯了NPM,當我運行npm install jsdom命令時,我收到了很多錯誤。這裏是打印輸出:NPM和jsdom錯誤加載

npm WARN [email protected] package.json: bugs['web'] should probably be bugs['url'] 

> [email protected] 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 [email protected] Error: [email protected] preinstall: `node-waf clean || true; node-waf configure build` 
npm ERR! error installing [email protected] `sh "-c" "node-waf clean || true; node-waf configure build"` failed with 1 
npm ERR! error installing [email protected]  at ChildProcess.<anonymous> (/usr/lib/nodejs/npm/lib/utils/exec.js:49:20) 
npm ERR! error installing [email protected]  at ChildProcess.emit (events.js:70:17) 
npm ERR! error installing [email protected]  at maybeExit (child_process.js:359:16) 
npm ERR! error installing [email protected]  at Process.onexit (child_process.js:395:5) 
npm ERR! error installing [email protected] Error: [email protected] preinstall: `node-waf clean || true; node-waf configure build` 
npm ERR! error installing [email protected] `sh "-c" "node-waf clean || true; node-waf configure build"` failed with 1 
npm ERR! error installing [email protected]  at ChildProcess.<anonymous> (/usr/lib/nodejs/npm/lib/utils/exec.js:49:20) 
npm ERR! error installing [email protected]  at ChildProcess.emit (events.js:70:17) 
npm ERR! error installing [email protected]  at maybeExit (child_process.js:359:16) 
npm ERR! error installing [email protected]  at Process.onexit (child_process.js:395:5) 
npm ERR! [email protected] 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 [email protected] 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. 我在這裏做錯了什麼?

謝謝。

+0

我想知道你是如何在沒有C++編譯器的情況下構建節點的... – 2012-01-14 13:19:11

回答

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

你還沒有安裝編譯東西所需的基本東西。在Debian和Ubuntu上,這應該修復它:

sudo apt-get install build-essential 

對於其他發行版,命令有所不同,但基本原理相同。