Firebase 功能部署错误:无法解决“未找到命令‘插件’” - 需要专家建议

问题描述 投票:0回答:2

我在尝试使用 Firebase CLI 部署 Firebase Functions 时遇到问题。每当我尝试在项目中部署功能时,我都会收到以下错误

Build failed: yarn run v1.22.19  
error Command "plugin" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.; Error ID: e83c667d
Build failed: yarn run v1.22.19
error Command "plugin" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.; Error ID: e83c667d

Functions deploy had errors with the following functions:
        holderOnCreate(us-central1)
        messageOnCreate(us-central1)
i  functions: cleaning up build files...
Error: There was an error deploying functions:
 1. Error Failed to update function messageOnCreate in region us-central1
 2. Error Failed to update function holderOnCreate in region us-central1

我尝试了多种故障排除步骤,包括:

  1. 删除.yarn和node_modules目录并再次运行yarn(或npm install)。
  2. 验证所有文件都位于正确的路径中并且代码中没有错误。
  3. 确保所有依赖项和包都是最新的。
  4. 删除项目并从存储库重新下载,但问题仍然存在。
  5. 让其他人在他们的机器上测试相同的存储库,并且部署成功。
  6. 我仔细检查了我能够部署的另一个测试项目。这似乎是我的机器和这个特定项目的结合
  7. 我检查了整个项目,看看是否缺少一个插件。好像没找到
  8. 我用谷歌搜索了错误 ID,不幸的是没有任何结果。

FTR 这里是我在我的机器上安装的纱线和 npm 版本: npm - 9.5.1。纱线 3.5.1 (这很奇怪,因为错误显示了纱线 v1.22.19 行,我根本不知道它来自哪里)

尽管进行了这些尝试,我仍然无法在我的项目中部署 Firebase 功能。

任何人都可以提供有关可能导致此问题的原因的见解或建议吗?任何帮助将不胜感激。

deployment google-cloud-functions yarnpkg firebase-tools
2个回答
2
投票

我也有同样的问题。错误中的纱线版本是在谷歌服务器上运行的版本,看起来它已经非常过时了。

我最终删除了我的 firebase 功能项目

yarn.lock
并使用
npm run deploy
进行部署。这最终对我有用。


1
投票

今天刚遇到这个问题,并遇到了https://cloud.google.com/docs/buildpacks/nodejs#using_yarn,你只需要在package.json中显式指定yarn版本,例如:

  "engines": {
    "node": "16",
    "yarn": ">= 3.6.1"
  },

(酌情替换具体版本)

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.