繁体   English   中英

npm 安装 grpc 失败

[英]npm install grpc failed

enviroment: node version v8.9.3 npm >5.x

通过 npm 开始安装 grpc,我遇到了一些错误
npm install -g grpc

错误:

gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit 
(/Users/yuham/.nvm/versions/node/v8.9.3/lib/node_modules/node-
gyp/lib/build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit 
(internal/child_process.js:198:12)
gyp ERR! System Darwin 17.2.0
...
gyp ERR! cwd /Users/yuham/.nvm/versions/node/v8.9.3/lib/node_modules/grpc
gyp ERR! node -v v8.9.3
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 
...
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> 
(/Users/yuham/.nvm/versions/node/v8.9.3/lib/node_modules/
grpc/node_modules/node-
pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:126:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:925:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit 
(internal/child_process.js:209:5)
node-pre-gyp ERR! System Darwin 17.2.0
node-pre-gyp ERR! command "/Users/yuham/.nvm/versions/node/v8.9.3/bin/node" 
"/Users/yuham/.nvm/versions/node/v8.9.3/lib/node_modules/
grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--
library=static_library"
node-pre-gyp ERR! cwd 
/Users/yuham/.nvm/versions/node/v8.9.3/lib/node_modules/grpc
node-pre-gyp ERR! node -v v8.9.3
node-pre-gyp ERR! node-pre-gyp -v v0.6.38
node-pre-gyp ERR! not ok
Failed to execute '/Users/yuham/.nvm/versions/node/v8.9.3/bin/node 
/Users/yuham/.nvm/versions/node/v8.9.3/lib/node_modules/node-gyp/bin/node-
gyp.js build --fallback-to-build --library=static_library --
module=/Users/yuham/.nvm/versions/node/v8.9.3/lib/node_modules/
grpc/src/node/extension_binary/node-v57-darwin-x64/grpc_node.node --
module_name=grpc_node --
module_path=/Users/yuham/.nvm/versions/node/v8.9.3/lib/node_modules/
grpc/src/node/extension_binary/node-v57-darwin-x64' (1)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! grpc@1.6.6 install: `node-pre-gyp install --fallback-to-build --
library=static_library`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the grpc@1.6.6 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:

我尝试安装不同版本的grpc,但得到了相同的结果,而这个错误是由node-pre-gyp还是node-gyp引起的? 我的计算机系统是 osx --lts。 我找不到任何好的想法或解决方案。 如何解决?

运行这个命令,它会工作

npm install -g xxx --unsafe-perm

但我不明白“--unsafe-perm”是什么意思?

我发现问题是缺少包request 在安装 grpc 之前安装它修复了我的问题。 如果您有依赖于grpc的软件包,请先安装request

yarn add request

yarn add grpc

一位同事提到了公司代理的事情。 不知道这是否真的是问题所在,但添加request确实解决了问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM