我刚刚用这个函数npm i firebase-functions@latest更新了Firebase函数,并更新了npm install -g firebase-tools.突然之间,我无法在firebase deploy --only functions部署我所有的功能.我得到了所有这些错误:

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.

有人知道发生了什么事吗?我在stackoverflow上试过这个功能,但一点也不成功.请帮帮我!我已经这样两天了!

Images of functions

Images of functions

推荐答案

您遇到的问题是,在版本>=2.0.0中,firebase-functions-test指定它需要Firebase函数.NPM将其解释为"stable个版本大于或等于2.0.0".这意味着像3.24.13.0.02.3.1这样的版本都是有效的,但像4.0.0-rc.0或假设的5.9.3-beta这样的版本就不会有效.

当您运行npm i firebase-functions@latest时,它获取了开发人员标记为"最新"的版本,即4.0.0-rc-0,这不满足前面提到的限制.

我建议显式安装一个稳定的版本(npm install firebase-functions@3.24.1),或者--如果您可以访问firebase-functions-test--将该包的package.json修改为"firebase-functions": ">=2.0.0 || 4.0.0-rc.0".

查看npm semver calculator,了解哪些说明符与哪些版本匹配.

Node.js相关问答推荐

如何在ejs模板中使用循环显示多个结果?

findoneandupdate()方法更新数据库,但其响应在请求中返回为null

Sequelize、postgres和posgis:在n°;公里

函数声明中的异步在没有等待的函数中做什么?

我收到警告:发现函数rs-ms-v1不受支持的运行时nodejs18.x× 不受支持的运行时

Next.js 路由不起作用 - 页面未正确加载

如何在MongoDB中删除嵌套对象数组中的属性?

Prisma,只有一个用户的行可以有真值,@@unique(userId, isActive)

运行 cypress 测试时如何指定 .env 文件用于我的开发服务器?

如何解决这个关于 TaskRunner 的 Node/Express 代码问题?

fastify:流过早关闭

Express.js cookie setter 的 Domain 属性:如何与 *多个 * 域共享 cookie?

更新文档数组中的文档 Mongoose

Mongoose-更新嵌套数组

来自 child_process.exec 的错误没有这样的设备或地址,管道有帮助.为什么?

如何从 Redis 保存和检索会话

在多个 .env 文件之间切换,例如 .env.development 和 node.js

如何在 Node.js 中使用 chmod

node 应用程序是否有任何独立的 gui 模块

nodeJS - 如何使用 express 创建和读取会话