node.js - 在 Windows 10(64 位)上使用 virtualbox 5.2.8 在 ubuntu 16.04 LTS 中执行 "npm install"命令时出错

标签 node.js hyperledger-fabric npm-install grpc node-pre-gyp

我一直在尝试安装并运行我的第一个 super 账本结构应用程序( http://hyperledger-fabric.readthedocs.io/en/latest/write_first_app.html ),但每次运行“npm install”命令时都会遇到以下问题。请让我知道解决此问题的解决方案是什么。 版本是: { fabcar: '1.0.0', npm: '5.6.0', 战神:'1.14.0', cldr: '33.1', http_parser: '2.8.0', 重症监护室:“62.1”, 模块:'64', 纳皮:'3', nghttp2: '1.32.0', Node :'10.8.0', openssl: '1.1.0h', tz: '2018e', 统一码:'11.0', 紫外线:'1.22.0', v8: '6.7.288.49-node.19', zlib: '1.2.11' }

错误如下:

vinusha@vinusha-VirtualBox:~/fabric-samples/fabcar$ npm install
npm WARN npm npm does not support Node.js v10.8.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/

grpc@1.10.1 install /home/vinusha/fabric-samples/fabcar/node_modules/fabric-client/node_modules/grpc node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp ERR! **Tried to download(403): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.10.1/node-v64-linux-x64-glibc.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for grpc@1.10.1 and node@10.8.0 (node-v64 ABI, glibc) (falling back to source compile with node-gyp) 
node-pre-gyp ERR! Pre-built binaries not installable for grpc@1.10.1 and node@10.8.0 (node-v64 ABI, glibc) (falling back to source compile with node-gyp) 
node-pre-gyp ERR! Hit error Connection closed while downloading tarball file** 
make: Entering directory '/home/vinusha/fabric-samples/fabcar/node_modules/fabric-client/node_modules/grpc/build'
make: Entering directory '/home/vinusha/fabric-samples/fabcar/node_modules/fabric-client/node_modules/grpc/build'
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/avl/avl.o
rm: cannot remove './Release/.deps/Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o.d.raw': No such file or directory
grpc.target.mk:388: recipe for target 

'Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o' failed
make: *** [Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o] Error 1
make: Leaving directory '/home/vinusha/fabric-samples/fabcar/node_modules/fabric-client/node_modules/grpc/build'
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:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:238:12)
gyp ERR! System Linux 4.15.0-30-generic
gyp ERR! command "/usr/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/home/vinusha/fabric-samples/fabcar/node_modules/fabric-client/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-glibc/grpc_node.node" "--module_name=grpc_node" "--module_path=/home/vinusha/fabric-samples/fabcar/node_modules/fabric-client/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-glibc"
gyp ERR! cwd /home/vinusha/fabric-samples/fabcar/node_modules/fabric-client/node_modules/grpc
gyp ERR! node -v v10.8.0
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 '/usr/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/home/vinusha/fabric-samples/fabcar/node_modules/fabric-client/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-glibc/grpc_node.node --module_name=grpc_node --module_path=/home/vinusha/fabric-samples/fabcar/node_modules/fabric-client/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-glibc' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/vinusha/fabric-samples/fabcar/node_modules/fabric-client/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:962:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:249:5)
node-pre-gyp ERR! System Linux 4.15.0-30-generic
node-pre-gyp ERR! command "/usr/bin/node" "/home/vinusha/fabric-samples/fabcar/node_modules/fabric-client/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd /home/vinusha/fabric-samples/fabcar/node_modules/fabric-client/node_modules/grpc
node-pre-gyp ERR! node -v v10.8.0
node-pre-gyp ERR! node-pre-gyp -v v0.7.0
node-pre-gyp ERR! not ok 
Failed to execute '/usr/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/home/vinusha/fabric-samples/fabcar/node_modules/fabric-client/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-glibc/grpc_node.node --module_name=grpc_node --module_path=/home/vinusha/fabric-samples/fabcar/node_modules/fabric-client/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-glibc' (1)
npm WARN fabcar@1.0.0 No repository field.

npmsh: 0: getcwd() failed: No such file or directory
/bin/sh: 1: cannot create ./Release/.deps/Release/obj.target/grpc/deps/grpc/src/core/lib/avl/avl.o.d: Directory nonexistent
grpc.target.mk:388: recipe for target 'Release/obj.target/grpc/deps/grpc/src/core/lib/avl/avl.o' failed
make: *** [Release/obj.target/grpc/deps/grpc/src/core/lib/avl/avl.o] Error 2
make: Leaving directory '/home/vinusha/fabric-samples/fabcar/node_modules/fabric-client/node_modules/grpc/build'
gyp  ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! grpc@1.10.1 install: `node-pre-gyp install --fallback-to-build --library=static_library`
npm ERR!ERR! Exit status 1
npm ERR!  
npmbuild error 
gyp ERR! Failed at the grpc@1.10.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
 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:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:238:12)
gyp ERR! System Linux 4.15.0-30-generic
gyp ERR! command "/usr/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/home/vinusha/fabric-samples/fabcar/node_modules/fabric-client/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-glibc/grpc_node.node" "--module_name=grpc_node" "--module_path=/home/vinusha/fabric-samples/fabcar/node_modules/fabric-client/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-glibc"
gyp ERR! cwd /home/vinusha/fabric-samples/fabcar/node_modules/fabric-client/node_modules/grpc
gyp ERR! node -v v10.8.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 

最佳答案

刚刚设法让“npm install”正常工作。这里的主要错误是我使用的nodejs版本是10.8.0,而hyperledger要求nodejs版本低于9。

我卸载了nodejs和npm并重新安装了版本8.11.3。此后,在安装 Node 和 npm 后,运行“hash -r”非常重要,以防 npm 版本未显示。

关于node.js - 在 Windows 10(64 位)上使用 virtualbox 5.2.8 在 ubuntu 16.04 LTS 中执行 "npm install"命令时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51849164/

相关文章:

docker - Composer Chaincode 容器生命周期

hyperledger-fabric - MVCC_READ_CONFLICT 并发提交多个事务时

javascript - NPM 安装出现 fatal error : reference is not a tree

node.js - Node NPM 安装 - 500 内部服务器错误

node.js - 安装 sinopia npm 后无法正常工作

node.js - 什么是 bodyParser() 和 CookieParser

node.js - 如何在通过 Azure Active Directory 生成授权 token 时修复 'connect ETIMEDOUT'?

node.js - 谷歌预测 API 一些实例错误

javascript - Node.js exec 事件未在 Promise 内触发

go - 未实现的 desc = 未知服务 protos.ChaincodeSupport