6

I just updated firebase functions with this function npm i firebase-functions@latest, and updated npm install -g firebase-tools. And suddenly I have unabled to deploy all of my functions at firebase deploy --only functions. I got all of these errors:

Build failed: npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: firebase-functions-test@0.2.3
npm ERR! Found: firebase-functions@4.0.0-rc.0
npm ERR! node_modules/firebase-functions
npm ERR!   firebase-functions@"^4.0.0-rc.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer firebase-functions@">=2.0.0" from firebase-functions-test@0.2.3
npm ERR! node_modules/firebase-functions-test
npm ERR!   dev firebase-functions-test@"^0.2.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: firebase-functions@3.24.1
npm ERR! node_modules/firebase-functions
npm ERR!   peer firebase-functions@">=2.0.0" from firebase-functions-test@0.2.3
npm ERR!   node_modules/firebase-functions-test
npm ERR!     dev firebase-functions-test@"^0.2.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /www-data-home/.npm/eresolve-report.txt for a full report.

Anyone know what's happening? I have tried this function on stackoverflow, but no luck at all. npm install --legacy-peer-deps Please help me! I have been like this for two days!

Images of functions

Images of functions

John Paul R
  • 649
  • 5
  • 10
Wege
  • 177
  • 2
  • 11

2 Answers2

2

The issue that you're encountering is that firebase-functions-test specifies that it needs firebase-functions at at version >=2.0.0. npm interprets this as "stable versions greater than or equal to 2.0.0". That means versions like 3.24.1, 3.0.0, 2.3.1 would all be valid, but things like 4.0.0-rc.0 or a hypothetical 5.9.3-beta would not.

When you ran npm i firebase-functions@latest, it grabbed the version that the devs had tagged as "latest", which was 4.0.0-rc-0, which does not satisfy the aforementioned constraint.

I'd recommend explicitly installing a stable version (npm install firebase-functions@3.24.1), or -if you have access to firebase-functions-test- modify that package's package.json to specify "firebase-functions": ">=2.0.0 || 4.0.0-rc.0".

Check out the npm semver calculator to see what specifiers match which versions.

John Paul R
  • 649
  • 5
  • 10
  • 1
    Nah, it doesn't solve it either. I think I will rebuild this project from beginning. Thank you anyway. – Wege Oct 16 '22 at 00:50
  • 1
    If anyone wanna know what is going on, visit this link: https://github.com/firebase/firebase-tools/issues/5132 – Wege Oct 16 '22 at 11:37
1

Just use this

npm install --legacy-peer-deps --save package-name