7

I am trying to use Firebase admin SDK in my server. When I deploy I get the error I am missing file node-v59-linux-x64/grpc_node.node in firebase-admin node_module map. I added "grpc": "1.7.1" in my package, but I still do not get that file after NPM update. I get an older version, node-v57. I also checked this path https://registry.npmjs.org/grpc/-/grpc-1.7.1.tgz, but I could not locate the file. I deleted my node_modules map and ran npm install again, still no node-v59.

How/where can I download that file? Is there any one who can put the file here so I can manually add it?

Error: Cannot find module '/data/app/node_modules/grpc/src/node/extension_binary/node-v59-linux-x64/grpc_node.node'

NoKey
  • 129
  • 11
  • 32

3 Answers3

7

This kind of problem is usually caused by installing the library on one system, then deploying and running it on a different system that requires a different binary file.

The simplest solution to this problem is to run npm rebuild after deployment on the system you deployed on.

Alternatively, if npm rebuild is not an option, you can pre-install the binary for the system you are deploying on by running npm install with some extra options. The --target argument allows you to install for a different version of Node. An argument of --target=9.0.0 installs the binary for Node 9 (only the major version has to match). The --target_platform argument allows you to install for a specific operating system: windows, linux, or darwin (Mac). The --target_arch argument lets you install for a different processor architecture: ia32, x64, or arm. And finally, the --target_libc argument lets you select binaries built for a different libc: glibc or musl (for Alpine Linux).

So, in your case, you should be able to get that binary by running

npm install --target=9.0.0 --target_platform=linux --target_arch=x64
murgatroid99
  • 19,007
  • 10
  • 60
  • 95
  • I was having the similar error message `Error: Cannot find module 'project/node_modules/grpc/src/node/extension_binary/node-v59-linux-x64-glibc/grpc_node.node'` I have not moved the code but I think I recently upgraded node by a major reversion (8 => 9). `npm rebuild` did the trick. Thank you. – Milton Apr 02 '18 at 21:46
2

I had the same problem. You can download the file here: https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.7.1/node-v59-linux-x64.tar.gz

J. Doe
  • 12,159
  • 9
  • 60
  • 114
2

This helped in my case, based on @murgatroid99’s answer:

npm rebuild --target=8.1.0 --target_platform=linux --target_arch=x64 --target_libc=glibc --update-binary

It downloads the required binary to your node_modules/grpc directory.

I run macOS X on my dev machine and I’m deploying to AWS Lambda; this keeps both runtime versions installed, which means I can develop and test locally and then deploy to Lambda.

AndreasPizsa
  • 1,736
  • 19
  • 26