2
votes

I had the a @grpc/grpc-js only works on Node ^8.13.0 || >=10.10.0 error thrown when deploying my cloud functions. I installed nvm and updated node to 12.13.1 with firebase tools version 7.8.1. I ran npm install again and redeployed my cloud functions and got the following error message thrown:

Error: Error parsing triggers: Cannot find module 'firebase'

Require stack:

  • /Users/chriscynn/Desktop/pretzly/pretzly/functions/index.js

  • /usr/local/lib/node_modules/firebase-tools/lib/triggerParser.js

I understand this means the firebase module in the node_modules folder does not exist, which is true. So I entered the npm install firebase command and at the very bottom I've pasted in entirety what prints out.

Any help would be appreciated, been toiling for the past couple days - clearing, installing, reinstalling, uninstalling, etc - and can't find a glimmer of hope in resolving. I'm fairly new to programming and even worse in understanding CLI.

My current package.json is...

enter image description here

CLI npm install firebase Error Log

1. [email protected] install /Users/me/Desktop/appName/appName/functions/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 Tried to download(404): https://node-precompiled-binaries.grpc.io/grpc/v1.20.0/node-v72-darwin-x64-unknown.tar.gz

node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v72 ABI, unknown) (falling back to source compile with node-gyp)

2. Rows of "CXX(target) Release/obj.target..." print out

3. ../ext/channel.cc:292:56: error: too few arguments to function call, expected 2, have 1
int try_to_connect = (int)info[0]->Equals(Nan::True());

/Users/me/Library/Caches/node-gyp/12.13.1/include/node/v8.h:2616:3: note: 'Equals' declared here V8_WARN_UNUSED_RESULT Maybe Equals(Local context,

/Users/me/Library/Caches/node-gyp/12.13.1/include/node/v8config.h:351:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT' define V8_WARN_UNUSED_RESULT attribute((warn_unused_result))

1 error generated.

make: *** [Release/obj.target/grpc_node/ext/channel.o] Error 1

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: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 Darwin 18.7.0

gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/Users/me/Desktop/appName/appName/functions/node_modules/grpc/src/node/extension_binary/node-v72-darwin-x64-unknown/grpc_node.node" "--module_name=grpc_node" "--module_path=/Users/me/Desktop/appName/appName/functions/node_modules/grpc/src/node/extension_binary/node-v72-darwin-x64-unknown" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"

gyp ERR! cwd /Users/me/Desktop/appName/appName/functions/node_modules/grpc

gyp ERR! node -v v12.13.1

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 '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/Users/me/Desktop/appName/appName/functions/node_modules/grpc/src/node/extension_binary/node-v72-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/Users/me/Desktop/appName/appName/functions/node_modules/grpc/src/node/extension_binary/node-v72-darwin-x64-unknown --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)

node-pre-gyp ERR! stack at ChildProcess. (/Users/me/Desktop/appName/appName/functions/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 Darwin 18.7.0

node-pre-gyp ERR! command "/usr/local/bin/node" "/Users/me/Desktop/appName/appName/functions/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"

node-pre-gyp ERR! cwd /Users/me/Desktop/appName/appName/functions/node_modules/grpc

node-pre-gyp ERR! node -v v12.13.1

node-pre-gyp ERR! node-pre-gyp -v v0.12.0

node-pre-gyp ERR! not ok

Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/Users/me/Desktop/appName/appName/functions/node_modules/grpc/src/node/extension_binary/node-v72-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/Users/me/Desktop/appName/appName/functions/node_modules/grpc/src/node/extension_binary/node-v72-darwin-x64-unknown --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! [email protected] install: node-pre-gyp install --fallback-to-build --library=static_library

npm ERR! Exit status 1

npm ERR! Failed at the [email protected] install script.

3
What do you intend to do with the firebase and firebase/app modules, considering that they're intended for use in web browsers and not so much for node? Usually for backends, just firebase-admin is used.Doug Stevenson
@DougStevenson thanks for the comment. Not entirely sure if I'm answering correctly, but via the index.js file, I have firebase modules to send push notifications and to also update firestore data.Chris

3 Answers

1
votes

the problem in that log is that you are installing grpc version 1.20.0, which does not support Node 12. You need to either remove whichever library depends on grpc, or use a newer version of grpc, or use an older version of Node.

0
votes

The things you're trying to do can all be done with firebase-admin. Don't use the other Firebase web client libraries, as they're not meant for node. Just remove all the other firebase dependencies except for firebase-admin and firebase-functions to get started.

0
votes

First of All You need to make sure to remove any conflicting versions of npm

sudo apt-get autoremove 

second use the following to install latest of npm

curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash - 

then

sudo apt-get install -y nodejs

that's for Debian distros, for another OS check this link: https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions-enterprise-linux-fedora-and-snap-packages

Alternatively, you can also use

sudo npm install -g npm@latest

or for version 8.13.0 particularly

 sudo npm install -g [email protected]