Firebase Functions部署错误:无法解决“找不到命令’plugin’” – 需要专家建议

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

Firebase Functions Deployment Error: Can't Resolve 'Command 'plugin' not found' - Need Expert Advice

问题

我在尝试使用Firebase CLI部署Firebase Functions时遇到了问题。每当我尝试部署项目中的函数时,我收到以下错误消息

构建失败:yarn run v1.22.19
错误命令“plugin”未找到。
info访问https://yarnpkg.com/en/docs/cli/run以获取有关此命令的文档;错误ID:e83c667d
构建失败:yarn run v1.22.19
错误命令“plugin”未找到。
info访问https://yarnpkg.com/en/docs/cli/run以获取有关此命令的文档;错误ID:e83c667d

以下函数部署时出现错误:
        holderOnCreate(us-central1)
        messageOnCreate(us-central1)
i  functions:清理构建文件...
错误:部署函数时出现错误:
 1. 错误:无法更新区域us-central1中的函数messageOnCreate
 2. 错误:无法更新区域us-central1中的函数holderOnCreate

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

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

附注:我在我的计算机上安装的yarn和npm版本如下:
npm - 9.5.1。yarn 3.5.1(奇怪的是,错误显示的是yarn v1.22.19,我完全不知道它从哪里来)

尽管尝试了这些方法,我仍然无法部署Firebase Functions到我的项目中。是否有人可以提供关于可能导致这个问题的见解或建议?任何帮助将不胜感激。

英文:

I am encountering an issue while trying to deploy Firebase Functions using the Firebase CLI. Whenever I attempt to deploy the functions in my project, I receive the following error

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

I have tried several troubleshooting steps, including:

  1. Deleting the .yarn and node_modules directories and running yarn (or npm install) again.
  2. Verifying that all files are in the correct paths and there are no errors in the code.
  3. Ensuring that all dependencies and packages are up to date.
  4. Deleting the project and redownloading it from the repository, but the issue persists.
  5. Having someone else test the same repository on their machine, and the deployment was successful.
  6. I doubled checked with a different test project that I am able to deploy. It seems a combination of my machine and this specific project
  7. I've looked through my whole project to see if there's a plugin missing. I can't seem to find any
  8. I've googled the error ID and unfortunately nothing is coming up.

FTR here yarn and npm versions I have installed on my machine:
npm - 9.5.1. yarn 3.5.1 (Its weird because the error is displaying the line yarn v1.22.19, and I have literally no idea where that's coming from)

Despite these attempts, I am still unable to deploy the Firebase Functions in my project.

Could anyone provide insights or suggestions on what might be causing this issue? Any help would be greatly appreciated.

答案1

得分: 1

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

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

(根据需要替换具体版本)

英文:

Just ran into this today, and came across https://cloud.google.com/docs/buildpacks/nodejs#using_yarn, you just need to explicitly specify the yarn version in your package.json, e.g.:

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

(replace specific versions as appropriate)

答案2

得分: 0

我遇到了相同的问题。错误中的yarn版本是在Google的服务器上运行的版本,似乎非常过时。

最后,我删除了我的Firebase函数项目中的yarn.lock文件,并使用npm run deploy进行部署。这对我来说有效。

英文:

I had the same issue. The yarn version in the error is the one that's running on Google's servers and it seems like it's very out of date.

I ended up removing my firebase functions project yarn.lock and deployed with npm run deploy. That ended up working for me.

huangapple
  • 本文由 发表于 2023年6月8日 08:58:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/76427975.html
匿名

发表评论

匿名网友

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

确定