英文:
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!
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论