2017-08-29 465 views
2

我是新來的節點,並且在這裏我的深度有點偏離。在Mac OS X和Centos 6上遇到此錯誤。在我嘗試的所有npm install xxx命令中發生。任何建議如何解決這個錯誤非常讚賞。運行npm install時出現node-gyp錯誤

npm install gives node-gyp error類似,但我的用戶名中沒有空格,這是解決他問題的方法。

npm install canvas 

> [email protected] install /home/test1/ng2-webpack-demo/node_modules/canvas 
> node-gyp rebuild 

Package cairo was not found in the pkg-config search path. 
Perhaps you should add the directory containing `cairo.pc' 
to the PKG_CONFIG_PATH environment variable 
No package 'cairo' found 
gyp: Call to './util/has_lib.sh freetype' returned exit status 0 while in 
binding.gyp. while trying to load binding.gyp 
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1 
gyp ERR! stack  at ChildProcess.onCpExit 
(/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:336:16) 
gyp ERR! stack  at emitTwo (events.js:106:13) 
gyp ERR! stack  at ChildProcess.emit (events.js:191:7) 
gyp ERR! stack  at Process.ChildProcess._handle.onexit 
(internal/child_process.js:215:12) 
gyp ERR! System Linux 2.6.32-642.4.2.el6.x86_64 
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node- 
gyp/bin/node-gyp.js" "rebuild" 
gyp ERR! cwd /home/test1/ng2-webpack-demo/node_modules/canvas 
gyp ERR! node -v v6.11.1 
gyp ERR! node-gyp -v v3.6.2 
gyp ERR! not ok 
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but 
none was installed. 
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] 
beta.8 but none was installed. 
npm WARN @angular/[email protected] requires a peer of 
@angular/[email protected]^4.0.0 but none was installed. 
npm WARN @angular/[email protected] requires a peer of 
@angular/[email protected]^4.0.0 but none was installed. 
npm WARN @ngtools/[email protected] requires a peer of @angular/tsc- 
[email protected]^0.5.0 but none was installed. 
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] 
(node_modules/fsevents): 
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for 
[email protected]: wanted {"os":"darwin","arch":"any"} (current: 
{"os":"linux","arch":"x64"}) 

npm ERR! code ELIFECYCLE 
npm ERR! errno 1 
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 probably not a problem with npm. There is likely additional 
logging output above. 

npm ERR! A complete log of this run can be found in: 
npm ERR!  /home/test1/.npm/_logs/2017-08-29T15_54_58_848Z-debug.log 
+0

對於那些誰沿着我解決了這個方式來爲切換到一個CentOS 7箱,然後運行RPM -ivh https://開頭kojipkgs.fedoraproject.org//packages/http-parser/2.7.1/3.el7/x86_64/http-parser-2.7.1-3.el7.x86_64.rpm&& yum -y根據以下內容安裝nodejs:https:/ /bugs.centos.org/view.php?id=13669&nbn=1 – mba12

回答