0

I updated Brew then updated Node from 10.12.0 -> 13.8.0

Now, I get the following error when trying to deploy a Google Cloud Function

firebase deploy --only functions:createJWT

i functions: preparing functions directory for uploading...

Error: Error parsing triggers: Failed to load gRPC binary module because it was not installed for the current system Expected directory: node-v79-darwin-x64-unknown Found: [node-v64-darwin-x64-unknown] This problem can often be fixed by running "npm rebuild" on the current system Original error: Cannot find module '/Users/.../cloud-functions/functions/node_modules/grpc/src/node/extension_binary/node-v79-darwin-x64-unknown/grpc_node.node' Require stack: - /Users/.../cloud-functions/functions/node_modules/grpc/src/grpc_extension.js - /Users/.../cloud-functions/functions/node_modules/grpc/src/client_interceptors.js - /Users/.../cloud-functions/functions/node_modules/grpc/src/client.js - /Users/.../cloud-functions/functions/node_modules/grpc/index.js - /Users/.../cloud-functions/functions/node_modules/@google-cloud/common-grpc/src/service.js - /Users/.../cloud-functions/functions/node_modules/@google-cloud/common-grpc/src/operation.js - /Users/.../cloud-functions/functions/node_modules/@google-cloud/common-grpc/src/index.js - /Users/.../cloud-functions/functions/node_modules/@google-cloud/logging/src/index.js - /Users/.../cloud-functions/functions/index.js - /usr/local/lib/node_modules/firebase-tools/lib/triggerParser.js

Try running "npm install" in your functions directory before deploying.

Tried npm rebuild and npm install in my functions directory and nothing works

Furthermore...could this issue be due to the fact that GCF Node runtime enviroment is Node10 and I have installed Node13 on my machine? - according to these docs:

https://cloud.google.com/functions/docs/concepts/nodejs-10-runtime

I am struggling to revert back to Node10, have tried by running brew install node@10 and get this:

enter image description here

Then tried running the following command as per output above to symlink it to /usr/local but still no luck

echo 'export PATH="/usr/local/opt/node@10/bin:$PATH"' >> ~/.bash_profile
Roggie
  • 1,157
  • 3
  • 16
  • 40

2 Answers2

1

Searching around about this error, indeed, this seems that the problem is related to your system waiting for a version and founding another one - as per this part of the error.

Error: Error parsing triggers: Failed to load gRPC binary module because it was not installed for the current system Expected directory: node-v79-darwin-x64-unknown Found: [node-v64-darwin-x64-unknown]

There are some options that you can give it a try, besides trying the npm rebuild. Another option might be updating the package.json - as per this case solved here - that would return your npm version to an old one.

Besides that, on this question in the Community, there are a few solutions that helped other users, that I would recommend you to take a look at it: NodeJs Error - Failed to load gRPC binary module because it was not installed for the current system Expected directory?

Let me know if the information helped you!

gso_gabriel
  • 4,199
  • 1
  • 10
  • 22
  • my `package.json` specifies `"node": "10"` if I change to `12` I get `Error: The only valid choices are: {"node": "8"} and {"node": "10"}` when I run `firebase deploy functions`....so correct me if my thinking is wrong, my machine has `node 13.8` and trying to deploy to `node10` Google env doesnt like it? – Roggie Feb 19 '20 at 10:08
  • 1
    Hi, @Roggie checking the official documentation, it seems that [Node.js 8](https://cloud.google.com/functions/docs/concepts/nodejs-8-runtime) is supported and [Node.js 10](https://cloud.google.com/functions/docs/concepts/nodejs-10-runtime) is still in Beta. This confirms that indeed, Cloud Functions don't support Node.js 13 is supported yet. I would recommend you to raise a feature request for it [here](https://cloud.google.com/support/docs/issue-trackers), for this to be checked by Google. – gso_gabriel Feb 19 '20 at 10:19
  • 1
    yes, trying to deploy from a higher version was the issue, going back to `node10.19.0` worked. – Roggie Feb 19 '20 at 21:54
  • Nice! Thanks for confirming that, @Roggie! – gso_gabriel Feb 20 '20 at 09:17
  • 1
    @Roggie Please, consider accepting or upvoting my answer, if you think it helped! – gso_gabriel Feb 26 '20 at 13:09
0

Trying to deploy to an unsupported Google Function execution environment won't work. According to the google docs the current supported environments are Node8 and Node10(beta), re-installing Node10 worked for me.

Roggie
  • 1,157
  • 3
  • 16
  • 40