2013-12-21 53 views
1

我無法通過節點npm(使用sudo)獲取topojson以在小牛上安裝。我安裝了Xcode命令行工具,並嘗試過各種解決方案,但沒有運氣。這是我的輸出:在OSX上安裝topojson節點爲npm的小牛

> [email protected] 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! [email protected] install: `node-gyp rebuild` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] 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 

任何想法?

回答

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工作得很好。

+0

謝謝 - 我遇到了類似的問題,你的回答讓我嘗試更新gcc,這爲我解決了問題。 – kjones