Home > Enterprise >  NPM Error: Fix the upstream dependency conflict installing NPM Packages (Cloud Function)
NPM Error: Fix the upstream dependency conflict installing NPM Packages (Cloud Function)

Time:10-16

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: [email protected]
npm ERR! Found: [email protected]
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 [email protected]
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: [email protected]
npm ERR! node_modules/firebase-functions
npm ERR!   peer firebase-functions@">=2.0.0" from [email protected]
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 Images of functions

Images of functions

CodePudding user response:

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 [email protected]), 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.

  • Related