【问题标题】:NPM Install errorNPM 安装错误
【发布时间】:2012-02-09 07:26:59
【问题描述】:

我正在尝试让我的应用在本地运行。在尝试在文件夹中安装 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的作者投诉

标签: javascript node.js express npm


【解决方案1】:

我使用来自 Apple App Store 的 Xcode 4.3,并且必须安装 Unix 命令行工具。这可以通过 Xcode -> 首选项 -> 下载 -> 命令行工具来完成

【讨论】:

    【解决方案2】:

    “错误:无法配置 cxx 编译器!”

    您需要一个 C++ 编译器。您使用的是 OSX,所以您需要安装 XCode。

    这是一个关于该问题的 SO 答案,其中包括针对不同操作系统/发行版解决此错误的各种方法:

    How to compile/install node.js(could not configure a cxx compiler!) (Ubuntu).

    【讨论】:

    • 我有 XCode。忘了说我也查过了。我的版本:4.0.2版
    • 安装时是否勾选了“Unix Tools”选项?
    • 也可以看看这个:techskater.com/web-stuff/…
    【解决方案3】:

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

    【讨论】:

    • 它太迟钝了,你现在必须通过 App Store 下载 XCode。当我尝试时,它说我需要狮子。这太荒谬了。
    【解决方案4】:

    已修复!这对我有用。 我安装了 Lion 并更新了 XCode。 简单但耗时。

    【讨论】:

      猜你喜欢
      • 2023-03-30
      • 2022-01-10
      • 2016-04-03
      • 1970-01-01
      • 2014-11-21
      • 2015-10-24
      • 2014-07-27
      • 2015-06-16
      相关资源
      最近更新 更多