angularlinuxubuntunode-pre-gyp

`node-pre-gyp install` related error in Ubuntu 18.04


I'm trying to start working on an Angular project in my Ubuntu 18.04 system, but the npm i command fails after printing the following:

../ext/channel.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE grpc::node::Channel::GetConnectivityState(Nan::NAN_METHOD_ARGS_TYPE)’:
../ext/channel.cc:292:56: error: no matching function for call to ‘v8::Value::Equals(v8::Local<v8::Boolean>)’
   int try_to_connect = (int)info[0]->Equals(Nan::True());
                                                        ^
In file included from /home/asghwor/.cache/node-gyp/12.14.0/include/node/node.h:63:0,
                 from ../../nan/nan.h:58,
                 from ../ext/channel.cc:23:
/home/asghwor/.cache/node-gyp/12.14.0/include/node/v8.h:2616:37: note: candidate: v8::Maybe<bool> v8::Value::Equals(v8::Local<v8::Context>, v8::Local<v8::Value>) const
   V8_WARN_UNUSED_RESULT Maybe<bool> Equals(Local<Context> context,
                                     ^~~~~~
/home/asghwor/.cache/node-gyp/12.14.0/include/node/v8.h:2616:37: note:   candidate expects 2 arguments, 1 provided
At global scope:
cc1plus: error: unrecognized command line option ‘-Wno-cast-function-type’ [-Werror]
cc1plus: all warnings being treated as errors
grpc_node.target.mk:188: recipe for target 'Release/obj.target/grpc_node/ext/channel.o' failed
make: *** [Release/obj.target/grpc_node/ext/channel.o] Error 1
make: Leaving directory '/home/asghwor/Dados/company/My-Project/node_modules/grpc/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/asghwor/.nvm/versions/node/v12.14.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 5.4.0-90-generic
gyp ERR! command "/home/asghwor/.nvm/versions/node/v12.14.0/bin/node" "/home/asghwor/.nvm/versions/node/v12.14.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/home/asghwor/Dados/company/My-Project/node_modules/grpc/src/node/extension_binary/node-v72-linux-x64-glibc/grpc_node.node" "--module_name=grpc_node" "--module_path=/home/asghwor/Dados/company/My-Project/node_modules/grpc/src/node/extension_binary/node-v72-linux-x64-glibc" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
gyp ERR! cwd /home/asghwor/Dados/company/My-Project/node_modules/grpc
gyp ERR! node -v v12.14.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/home/asghwor/.nvm/versions/node/v12.14.0/bin/node /home/asghwor/.nvm/versions/node/v12.14.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/home/asghwor/Dados/company/My-Project/node_modules/grpc/src/node/extension_binary/node-v72-linux-x64-glibc/grpc_node.node --module_name=grpc_node --module_path=/home/asghwor/Dados/company/My-Project/node_modules/grpc/src/node/extension_binary/node-v72-linux-x64-glibc --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/asghwor/Dados/company/My-Project/node_modules/grpc/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
node-pre-gyp ERR! System Linux 5.4.0-90-generic
node-pre-gyp ERR! command "/home/asghwor/.nvm/versions/node/v12.14.0/bin/node" "/home/asghwor/Dados/company/My-Project/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd /home/asghwor/Dados/company/My-Project/node_modules/grpc
node-pre-gyp ERR! node -v v12.14.0
node-pre-gyp ERR! node-pre-gyp -v v0.12.0
node-pre-gyp ERR! not ok 
Failed to execute '/home/asghwor/.nvm/versions/node/v12.14.0/bin/node /home/asghwor/.nvm/versions/node/v12.14.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/home/asghwor/Dados/company/My-Project/node_modules/grpc/src/node/extension_binary/node-v72-linux-x64-glibc/grpc_node.node --module_name=grpc_node --module_path=/home/asghwor/Dados/company/My-Project/node_modules/grpc/src/node/extension_binary/node-v72-linux-x64-glibc --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.2 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/watchpack/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/karma/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN mat-select-autocomplete@1.3.0 requires a peer of @angular/common@^6.0.0-rc.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN mat-select-autocomplete@1.3.0 requires a peer of @angular/core@^6.0.0-rc.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN mat-select-autocomplete@1.3.0 requires a peer of @angular/animations@^6.1.10 but none is installed. You must install peer dependencies yourself.
npm WARN ng2-pdfjs-viewer@5.0.7 requires a peer of @angular/core@^8.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-quill-v2@0.0.1 requires a peer of quill@^2.0.0-dev.3 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/http@7.2.1 requires a peer of @angular/core@7.2.1 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/http@7.2.1 requires a peer of @angular/platform-browser@7.2.1 but none is installed. You must install peer dependencies yourself.
npm WARN pdfjs-dist@2.10.377 requires a peer of worker-loader@^3.0.7 but none is installed. You must install peer dependencies yourself.
npm WARN acorn-dynamic-import@4.0.0 requires a peer of acorn@^6.0.0 but none is installed. You must install peer dependencies yourself.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! grpc@1.20.0 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.20.0 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/asghwor/.npm/_logs/2021-11-29T13_10_35_405Z-debug.log

I'm using Angular 7.3.7 and Node 12.14.0.

I cannot update the project nor the system, since it's enforced by the company.

What can I do to run this project?

EDIT: Before the error above, it also printed this:

node-pre-gyp WARN Using request for node-pre-gyp https download 
node-pre-gyp WARN Tried to download(404): https://node-precompiled-binaries.grpc.io/grpc/v1.20.0/node-v72-linux-x64-glibc.tar.gz 
node-pre-gyp WARN Pre-built binaries not found for grpc@1.20.0 and node@12.14.0 (node-v72 ABI, glibc) (falling back to source compile with node-gyp) 
make: Entering directory '/home/asghwor/path-to-project/node_modules/@firebase/firestore/node_modules/grpc/build'
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o
// ... and many other file.o files

Solution

  • Found the solution here. It was an older version of Firebase causing this.

    Updating it to the latest version or to the version mentioned in the thread both fixed it for me.