兼容性错误在 Firebase 函数部署过程中发生。

huangapple go评论56阅读模式
英文:

Compatibility error that occurs during Firebase Functions deployment

问题

发生了以下错误。

npm ERR! code ERESOLVE
npm ERR! ERESOLVE 无法解析依赖树
npm ERR!
npm ERR! 在解析时出现问题:functions@undefined
npm ERR! 已找到:firebase-admin@undefined
npm ERR! node_modules/firebase-admin
npm ERR!   firebase-admin@"^111.5.0" 来自根项目
npm ERR!
npm ERR! 无法解析依赖:
npm ERR! 依赖于 firebase-admin@"^10.0.0 || ^11.0.0" 的同级依赖 firebase-functions@4.2.1
npm ERR! node_modules/firebase-functions
npm ERR!   firebase-functions@"^4.2.0" 来自根项目
npm ERR!
npm ERR! 修复上游依赖冲突,或重试
npm ERR! 通过 --force 或 --legacy-peer-deps 选项
npm ERR! 来接受不正确(可能损坏)的依赖解析。
npm ERR!
npm ERR!
npm ERR! 完整报告请参见:
npm ERR! C:\Users\user\AppData\Local\npm-cache\_logs23-02-19T05_41_15_922Z-eresolve-report.txt

npm ERR! 此运行的完整日志可在以下位置找到:
npm ERR!     C:\Users\user\AppData\Local\npm-cache\_logs23-02-19T05_41_15_922Z-debug-0.log

在研究解决方案后,我被建议使用以下命令,但问题仍然未解决。

npm install --force
npm install --legacy-peer-deps

有人能帮忙找到解决方案吗?

英文:

The following error has occurred.

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: functions@undefined
npm ERR! Found: firebase-admin@undefined
npm ERR! node_modules/firebase-admin
npm ERR!   firebase-admin@"^111.5.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer firebase-admin@"^10.0.0 || ^11.0.0" from firebase-functions@4.2.1
npm ERR! node_modules/firebase-functions
npm ERR!   firebase-functions@"^4.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!
npm ERR! For a full report see:
npm ERR! C:\Users\user\AppData\Local\npm-cache\_logs23-02-19T05_41_15_922Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\user\AppData\Local\npm-cache\_logs23-02-19T05_41_15_922Z-debug-0.log

After researching a solution, I was advised to use the following command, but the issue still remains unresolved.

npm install --force
npm install --legacy-peer-deps

Can anyone help me with a solution?

答案1

得分: 4

我刚遇到了与安装Firebase函数的依赖项相关的相同问题。对我有用的方法是进入“functions”文件夹中的“package.json”文件,并将

"firebase-admin": "^111.5.0"

更改为

"firebase-admin": "^11.0.0"

在运行 firebase init functions 之后,但在使用 npm 安装依赖项之前。希望这对您有帮助!

英文:

I just ran into this same issue installing dependencies for Firebase functions. What worked for me was going into the "package.json" file within the "functions" folder and changing

"firebase-admin": "^111.5.0"

to

"firebase-admin": "^11.0.0"

AFTER running firebase init functions, but before installing the dependencies with npm. Hope this helps!

huangapple
  • 本文由 发表于 2023年2月19日 13:53:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/75498261.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定