GRPC + Google Cloud: Cannot find module grpc_node.node

I have been running a small service on Google Compute Engine (Ubuntu) that requires the google-cloud npm module but I kept hitting an error with grpc_node.node not being found.

Error: Cannot find module '/home/paul_kinlan/web-push-rocks/frontend/node_modules/google-cloud/node_modules/grpc/src/node/extens
ion_binary/grpc_node.node'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Function._load (/usr/lib/node_modules/pm2/node_modules/pmx/lib/transaction.js:62:21)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/paul_kinlan/web-push-rocks/frontend/node_modules/google-cloud/node_modules/grpc/src/node/src/gr
pc_extension.js:38:15)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)

It was incredibly frustrating as I have not seen any recognition of the issues that many people are facing.

The solution that I found (well Surma on our team found) was to force a rebuild of the module from source as follows:

npm install
npm rebuild --build-from-source google-cloud

Stupid node. Stupid Cloud platform. :)

About Me: Paul Kinlan

I lead the Chrome Developer Relations team at Google.

We want people to have the best experience possible on the web without having to install a native app or produce content in a walled garden.

Our team tries to make it easier for developers to build on the web by supporting every Chrome release, creating great content to support developers on web.dev, contributing to MDN, helping to improve browser compatibility, and some of the best developer tools like Lighthouse, Workbox, Squoosh to name just a few.