【问题标题】:Installing topojson on OSX Mavericks with node npm使用 node npm 在 OSX Mavericks 上安装 topojson
【发布时间】:2013-12-21 12:49:03
【问题描述】:

我无法通过节点 npm(使用 sudo)在 Mavericks 上安装 topojson。我安装了 Xcode 命令行工具并尝试了各种解决方案,但没有运气。这是我的输出:

> contextify@0.1.6 install /usr/local/lib/node_modules/topojson/node_modules/d3/node_modules/jsdom/node_modules/contextify
> node-gyp rebuild

  CXX(target) Release/obj.target/contextify/src/contextify.o
cc1plus: error: unrecognized command line option "-arch"
make: *** [Release/obj.target/contextify/src/contextify.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Darwin 13.0.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/topojson/node_modules/d3/node_modules/jsdom/node_modules/contextify
gyp ERR! node -v v0.10.24
gyp ERR! node-gyp -v v0.12.1
gyp ERR! not ok
    ....
    npm ERR! contextify@0.1.6 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the contextify@0.1.6 install 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-gyp rebuild
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! System Darwin 13.0.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "topojson"
npm ERR! cwd /Users/mattmosier
npm ERR! node -v v0.10.24
npm ERR! npm -v 1.3.21
npm ERR! code ELIFECYCLE
    ....
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/mattmosier/npm-debug.log
npm ERR! not ok code 0

有什么想法吗?

【问题讨论】:

    标签: node.js npm osx-mavericks topojson


    【解决方案1】:

    我最终发现问题有两个方面。

    1) 我的 gcc 编译器版本太旧了。当最新的可用版本是 4.9 时,我使用的是 4.5。我更新了这个(Homebrew)并认为我会很清楚。没有。

    2) 我跑了which gcc,发现它仍然指向我用 Macports 加载的旧版本。因此,新版本的 gcc 和 Xcode 命令行工具都没有被使用(Macports 将所有内容都放入/opt/local/bin,而不是/usr/local/bin)。我通过从我的$PATH 中删除/opt/local/bin/opt/local/sbin 来纠正这个问题。在那之后,sudo npm install -g topojson 工作得很好。

    【讨论】:

    • 谢谢 - 我遇到了类似的问题,你的回答让我尝试更新 gcc,这为我解决了问题。
    猜你喜欢
    • 2014-08-21
    • 2014-01-28
    • 1970-01-01
    • 2014-11-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-29
    相关资源
    最近更新 更多