npm install ERR

问题描述

在使用root用户进行npm install安装时报错,具体问题详情如下

问题详情
[root@Muyi demo]# npm install --save fabric-ca-client

> grpc@1.21.1 install /root/Muyi/NodeJs/demo/node_modules/grpc
> node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp WARN Using needle for node-pre-gyp https download 
node-pre-gyp WARN Pre-built binaries not installable for grpc@1.21.1 and node@10.9.0 (node-v64 ABI, glibc) (falling back to source compile with node-gyp) 
node-pre-gyp WARN Hit error EACCES: permission denied, mkdir '/root/Muyi/NodeJs/demo/node_modules/grpc/src/node' 
gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/10.9.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/root/Muyi/NodeJs/demo/node_modules/grpc/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/root/Muyi/NodeJs/demo/node_modules/grpc/.node-gyp'
gyp ERR! System Linux 3.10.0-862.14.4.el7.x86_64
gyp ERR! command "/root/Muyi/Node/node-v10.9.0-linux-x64/bin/node" "/root/Muyi/Node/node-v10.9.0-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--library=static_library" "--module=/root/Muyi/NodeJs/demo/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-glibc/grpc_node.node" "--module_name=grpc_node" "--module_path=/root/Muyi/NodeJs/demo/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-glibc" "--napi_version=3" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v64"
gyp ERR! cwd /root/Muyi/NodeJs/demo/node_modules/grpc
gyp ERR! node -v v10.9.0
gyp ERR! node-gyp -v v3.7.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/root/Muyi/Node/node-v10.9.0-linux-x64/bin/node /root/Muyi/Node/node-v10.9.0-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --library=static_library --module=/root/Muyi/NodeJs/demo/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-glibc/grpc_node.node --module_name=grpc_node --module_path=/root/Muyi/NodeJs/demo/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-glibc --napi_version=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/root/Muyi/NodeJs/demo/node_modules/grpc/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:961:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:250:5)
node-pre-gyp ERR! System Linux 3.10.0-862.14.4.el7.x86_64
node-pre-gyp ERR! command "/root/Muyi/Node/node-v10.9.0-linux-x64/bin/node" "/root/Muyi/NodeJs/demo/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd /root/Muyi/NodeJs/demo/node_modules/grpc
node-pre-gyp ERR! node -v v10.9.0
node-pre-gyp ERR! node-pre-gyp -v v0.13.0
node-pre-gyp ERR! not ok 
Failed to execute '/root/Muyi/Node/node-v10.9.0-linux-x64/bin/node /root/Muyi/Node/node-v10.9.0-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --library=static_library --module=/root/Muyi/NodeJs/demo/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-glibc/grpc_node.node --module_name=grpc_node --module_path=/root/Muyi/NodeJs/demo/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-glibc --napi_version=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (1)
npm WARN demo@1.0.0 No description
npm WARN demo@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! grpc@1.21.1 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.21.1 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!     /root/.npm/_logs/2020-01-10T07_07_51_110Z-debug.log
[root@Muyi demo]# npm install --save fabric-ca-client@1.4.3
npm ERR! code ETARGET
npm ERR! notarget No matching version found for fabric-ca-client@1.4.3
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-01-10T07_09_38_198Z-debug.log
解决方案
主要解决方案有两个:
1:切换非root用户进行安装,亲测可用
2:安装时增加参数--unsafe-perm即可
# 增加后可正常安装
[root@Muyi demo]# npm install --save fabric-ca-client --unsafe-perm

> grpc@1.21.1 install /root/Muyi/Node/Project/demo/node_modules/grpc
> node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp WARN Using needle for node-pre-gyp https download 
[grpc] Success: "/root/Muyi/Node/Project/demo/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-glibc/grpc_node.node" is installed via remote
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN demo@1.0.0 No description
npm WARN demo@1.0.0 No repository field.

+ fabric-ca-client@1.4.4
added 139 packages from 114 contributors and audited 229 packages in 15.505s
found 0 vulnerabilities

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值