2014-12-02 34 views
0

我得到這個錯誤,而安裝運行node-gyp rebuild任何節點包:NPM安裝帆布死

SOLINK_MODULE(target) Release/canvas-postbuild.node 
clang: error: no such file or directory: '{{}' 
make: *** [Release/canvas-postbuild.node] 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.emit (events.js:98:17) 
gyp ERR! stack  at Process.ChildProcess._handle.onexit (child_process.js:810:12) 
gyp ERR! System Darwin 14.0.0 
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" 
gyp ERR! cwd /Users/arkadiy/node-canvas 
gyp ERR! node -v v0.10.33 
gyp ERR! node-gyp -v v1.0.1 
gyp ERR! not ok 

我有NPM 1.4。 28和/ usr/local的所有權限都是我的。鐺是最近十歲上下:

Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn) 
Target: x86_64-apple-darwin14.0.0 
Thread model: posix 

的錯誤是完全ungoogleable(嚴重,試試吧),我甚至不能告訴那裏被調用鐺因爲堆棧跟蹤僅用於回調處理程序。看起來像是shell替換/ xargs問題差不多?

+0

事實證明,這是由文字{}引起的LD_FLAGS中毒事件。閉幕問題。 – 2014-12-03 21:35:53

回答

0

原來我有一個文字LDFLAGS='{} -L/usr/local/opt/openssl/lib',因爲有些東西沒有被shell擴展。沒關係!

2

我會說你的節點/ npm安裝是可疑的。如果你從他們的github上

https://github.com/Automattic/node-canvas 

啓動並下載回購

git clone https://github.com/Automattic/node-canvas.git 

cd node-canvas 
npm install .  

注意上面的命令期間 - 即獲取上游依賴

我只是做這一切都很好 - 如果你得到上面的錯誤,然後我建議你刪除node/npm並從源代碼安裝。下面的步驟給你這樣一個乾淨的節點/從源頭

NPM安裝到重新開始刪除之前節點和NPM安裝以及這些:

sudo mv ~/.npmrc ~/.npmrc_ignore 
sudo mv ~/.npm ~/.npm_ignore 
sudo mv ~/tmp ~/tmp_ignore 
sudo mv ~/.npm-init.js ~/.npm-init.js_ignore 

下載源來自:http://nodejs.org/download/

cd node-v0.10.33 

定義環境變量NODE_PATH作爲後續模塊安裝的目錄

export NODE_PARENT=/some/desired/install/path_goes_here 

export NODE_PARENT=/usr/local/bin/nodejs # use this ONLY if you MUST install as root (sudo) 
export NODE_PARENT=${HOME}/nodejs-v0.10.33 # use this if you want to install modules as yourself 

export PATH=${NODE_PARENT}/bin:${PATH} 
export NODE_PATH=${NODE_PARENT}/lib/node_modules 

./configure --prefix=${NODE_PARENT} 

make 
make install 

該把它放到目錄由上述--prefix

定義,當您使用語法:NPM安裝-g some_cool_module 全球的-g安裝成DIR $ NODE_PATH,而不是你的$ PWD

重要看跌以上三個出口xxx = yyy 命令到你的〜/ .bashrc或一些這樣來堅持這些環境變量的變化

+0

我昨天從http://nodejs.org/抓取了新鮮的.pkg安裝程序,這看起來應該可行,但我會在今晚從源碼嘗試。 (另外,我安裝到PWD作爲另一個項目的依賴關係,但全局安裝時發生同樣的編譯錯誤) – 2014-12-02 23:13:59