Error while executing the "npm install" command in ubuntu 16.04 LTS using virtualbox 5.2.8 on windows 10(64 bit)

3.7k Views Asked by At

I have been trying to install and run my first hyperledger fabric application (http://hyperledger-fabric.readthedocs.io/en/latest/write_first_app.html) but have been encountering the following issue everytime I run the "npm install" command. Please let me know what is the solution to resolve this issue. The versions are: { fabcar: '1.0.0', npm: '5.6.0', ares: '1.14.0', cldr: '33.1', http_parser: '2.8.0', icu: '62.1', modules: '64', napi: '3', nghttp2: '1.32.0', node: '10.8.0', openssl: '1.1.0h', tz: '2018e', unicode: '11.0', uv: '1.22.0', v8: '6.7.288.49-node.19', zlib: '1.2.11' }

The error is as follows:

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/

[email protected] 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 [email protected] and [email protected] (node-v64 ABI, glibc) (falling back to source compile with node-gyp) 
node-pre-gyp ERR! Pre-built binaries not installable for [email protected] and [email protected] (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 [email protected] 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! [email protected] 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 [email protected] 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 
2

There are 2 best solutions below

0
On

If what I saw in your first code is what you really typed, then I would say that while using npm install that the name of the package is attached to it like this npm install lodash, not only npm install. So in your own case you have to append the two files you need which would be npm install fabric-ca-client and also npm install fabric-client.

0
On

Just managed to get the "npm install" working. The main error here was the nodejs version that I was using 10.8.0 whereas hyperledger requires nodejs version to be less than 9.

I uninstalled nodejs and npm and reinstalled version 8.11.3. Thereafter, after installing node and npm it is important to run "hash -r" incase the npm version is not getting displayed.