David Callanan
David Callanan

Reputation: 5968

firebase cloud funtions the engine node is incompatible with this module

I've created a firebase cloud functions project which has the following dependencies added by default and the following engines:

"dependencies": {
  "firebase-admin": "^8.0.0",
  "firebase-functions": "^3.1.0"
},
"engines": {
  "node": "8"
}

Whenever I run yarn add I get following error and dependency not added:

error [email protected]: The engine "node" is incompatible with this module. Expected version "^8.13.0 || >=10.10.0". Got "8.11.4"

I then try change node engine version to 10 "engines": {"node": "10"}, but now get the following error when I yarn add:

error functions@: The engine "node" is incompatible with this module. Expected version "10". Got "8.11.4"

How to solve this problem?

Upvotes: 11

Views: 4768

Answers (3)

Igor Parra
Igor Parra

Reputation: 10348

Use nvm so you can use differents version of node.


When installed you can see all available versiosn with:

$ nvm ls-remote
    v0.1.14
    v0.1.15
    v0.1.16
    v0.1.17
    v0.1.18
...
   v12.13.1
    v13.0.0
    v13.0.1
    v13.1.0
    v13.2.0

Then install the version you need. For example, for version 8:

$ nvm i 8
Downloading https://nodejs.org/dist/v8.16.2/node-v8.16.2-linux-x64.tar.xz...
######################################################################## 100,0%
WARNING: checksums are currently disabled for node.js v4.0 and later
Now using node v8.16.2 (npm v6.4.1)

Test:

$ node -v
v8.16.2

Upvotes: 2

JKleinne
JKleinne

Reputation: 1310

There's a Github issue which addressed the problem you are having. To summarize, you can:

  • run yarn config set ignore-engines true
  • Ensure the versions in node -v and npm -v matches the versions listed in package.json and if not, update to match the intended version

Upvotes: 17

ajorquera
ajorquera

Reputation: 1309

Probably you need to add this to your package.json

"engines": {
    "node": "8" // or "10"
}

Upvotes: -2

Related Questions