1

I've been working on this project a long time. Deployed this many times. But i opened this project after a month or so and I'm getting the following error after hitting firebase deploy --only functions

i  deploying functions
i  functions: ensuring necessary APIs are enabled...
i  runtimeconfig: ensuring necessary APIs are enabled...
✔  runtimeconfig: all necessary APIs are enabled
✔  functions: all necessary APIs are enabled
i  functions: preparing functions directory for uploading...

Error: Error occurred while parsing your function triggers.

Error: The module '/private/var/folders/n3/h9nbc_ys2732s35_9jlgh98c0000gn/T/fbfn_6601274o3l5DKN66/node_modules/grpc/src/node/extension_binary/grpc_node.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 51. This version of Node.js requires
NODE_MODULE_VERSION 57. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at Object.Module._extensions..node (module.js:598:18)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/private/var/folders/n3/h9nbc_ys2732s35_9jlgh98c0000gn/T/fbfn_6601274o3l5DKN66/node_modules/grpc/src/node/src/grpc_extension.js:38:15)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)

Generic Info:

npm -v 5.1.0

node -v v8.1.3

I also tried this with LTS release 6.11.0, the error looks a bit different but still is the same.

i  deploying database, functions, hosting
✔  database: rules ready to deploy.
i  functions: ensuring necessary APIs are enabled...
i  runtimeconfig: ensuring necessary APIs are enabled...
✔  runtimeconfig: all necessary APIs are enabled
✔  functions: all necessary APIs are enabled
i  functions: preparing functions directory for uploading...

Error: Error occurred while parsing your function triggers.

Error: Module version mismatch. Expected 48, got 51.
    at Error (native)
    at Object.Module._extensions..node (module.js:597:18)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/private/var/folders/n3/h9nbc_ys2732s35_9jlgh98c0000gn/T/fbfn_615356S6aA0PtZuOQ/node_modules/grpc/src/node/src/grpc_extension.js:38:15)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)

Tried to cd into

/private/var/folders/n3/h9nbc_ys2732s35_9jlgh98c0000gn/T/fbfn_6601274o3l5DKN66/node_modules/grpc/

and run

npm install --build-from-source

Still the same error.

Is there a crucial rebuild step i'm missing ?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Sanket Berde
  • 6,555
  • 4
  • 35
  • 39
  • Specifically, it's complaining about the module grpc. Have you tried updating it? Note that grpc has a native component (compiled c, not pure js). Did you take note of the error message and try `npm rebuild` and `npm install`? – Doug Stevenson Jul 08 '17 at 21:29
  • @DougStevenson I tried to cd into the dir and rebuild. I'm guessing thats not the correct way. How can you rebuild a dependency of a global package ? – Sanket Berde Jul 09 '17 at 04:14
  • Always use npm from the same directory where you would do `npm install` - where your package.json lives – Doug Stevenson Jul 09 '17 at 04:27
  • @DougStevenson This is a global package. This doesn't require a package.json. `npm install -g firebase-tools` – Sanket Berde Jul 09 '17 at 15:25

2 Answers2

1

Solved it. The firebase-tools package seem to need node V 7.10.0 as of now. Installed it via nvm.

This is just a temporary fix. If anyone knows how to rebuild the dependency of a global package, please post.

Sanket Berde
  • 6,555
  • 4
  • 35
  • 39
  • This [other stack post](https://stackoverflow.com/questions/41214381/how-to-upgrade-a-dependency-of-a-global-package-in-npm) may be of use in completing your answer. – Jordan Oct 12 '17 at 19:56
1

As suggested by Doug, I've rebuilt grpc:

npm rebuild grpc --update-binary

...and the error disappeared. You should give it a try.

AFMeirelles
  • 409
  • 3
  • 8
  • 25