NPM安装错误

3
我正在尝试在本地运行我的应用程序。为了在文件夹中安装NPM,当它到达以下位置时我收到了一条错误信息:
npm ERR! error installing contextify@0.0.7

我在网上搜索过,但所有结果都是关于在Windows7中出现错误的。我使用的是OSX系统,我已经安装了XCode。

以下是完整的打印输出:

gorteks$ npm install
npm http GET https://registry.npmjs.org/jquery
npm http 304 https://registry.npmjs.org/jquery
npm http GET https://registry.npmjs.org/jsdom
npm http GET https://registry.npmjs.org/htmlparser
npm http 304 https://registry.npmjs.org/htmlparser
npm WARN htmlparser@1.7.3 package.json: bugs['web'] should probably be bugs['url']
npm http 304 https://registry.npmjs.org/jsdom
npm http GET https://registry.npmjs.org/cssom
npm http GET https://registry.npmjs.org/contextify
npm http 304 https://registry.npmjs.org/cssom
npm http 304 https://registry.npmjs.org/contextify

> contextify@0.0.7 preinstall /Users/gorteks/Sites/digidj-app/node_modules/jquery/node_modules/jsdom/node_modules/contextify
> node-waf clean || (exit 0); node-waf configure build

Nothing to clean (project not configured)
Setting srcdir to                        : /Users/gorteks/Sites/digidj-   app/node_modules/jquery/node_modules/jsdom/node_modules/contextify 
Setting blddir to                        : /Users/gorteks/Sites/digidj-app/node_modules/jquery/node_modules/jsdom/node_modules/contextify/build 
Checking for program g++ or c++          : not found 
/Users/gorteks/Sites/digidj-  app/node_modules/jquery/node_modules/jsdom/node_modules/contextify/wscript:11: error: could   not configure a cxx compiler!
npm ERR! error installing contextify@0.0.7
npm ERR! error installing jsdom@0.2.10
npm ERR! error installing jquery@1.6.3
npm ERR! contextify@0.0.7 preinstall: `node-waf clean || (exit 0); node-waf configure build`
npm ERR! `sh "-c" "node-waf clean || (exit 0); 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 || (exit 0); 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 Darwin 10.8.0
npm ERR! command "node" "/usr/local/bin/npm" "install"
npm ERR! cwd /Users/gorteks/Sites/digidj-app
npm ERR! node -v v0.6.7
npm ERR! npm -v 1.1.0-beta-10
npm ERR! code ELIFECYCLE
npm ERR! message contextify@0.0.7 preinstall: `node-waf clean || (exit 0); node-waf       configure build`
npm ERR! message `sh "-c" "node-waf clean || (exit 0); node-waf configure build"` failed   with 1
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/gorteks/Sites/digidj-app/npm-debug.log
npm not ok

感谢大家的所有帮助!


更新 node,更新 npm,再试一次。如果仍然失败,请向 contextify 的作者投诉。 - user578895
4个回答

4

我使用了来自苹果应用商店的 Xcode 4.3 版本,并且我需要安装 Unix 命令行工具。这可以通过 Xcode -> 首选项 -> 下载 -> 命令行工具 完成。


2

我有XCode。忘了提到我也检查过了。我的版本是:版本4.0.2。 - David Diliberto
你在安装时有勾选“Unix工具”选项吗? - Ryan Olds
可以参考这个链接:http://www.techskater.com/web-stuff/problems-installing-node-js-on-os-x-lion/ - Ryan Olds

0

下载最新版本的 Xcode,从4.0升级到4.1


现在必须通过应用商店下载XCode,这太愚蠢了。当我尝试时,它说我需要Lion系统。这太荒谬了。 - David Diliberto

0
修复了!这是对我有效的方法。 我安装了Lion并更新了XCode。 简单但耗时。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接