[英]Can't deploy Firebase functions (Failed to fetch Run service undefined)
Can't deploy Firebase functions.无法部署 Firebase 函数。 I have two project aliases, it's working fine for the first project (dev), but not for the second (prod).
我有两个项目别名,它在第一个项目 (dev) 中运行良好,但在第二个项目 (prod) 中运行良好。
Whenever I write firebase deploy --only functions
I get the following message每当我写
firebase deploy --only functions
时,我都会收到以下消息
i deploying functions
i functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i functions: ensuring required API cloudbuild.googleapis.com is enabled...
i artifactregistry: ensuring required API artifactregistry.googleapis.com is enabled...
+ functions: required API cloudbuild.googleapis.com is enabled
+ artifactregistry: required API artifactregistry.googleapis.com is enabled
+ functions: required API cloudfunctions.googleapis.com is enabled
i functions: preparing codebase default for deployment
! functions: package.json indicates an outdated version of firebase-functions. Please upgrade
using npm install --save firebase-functions@latest in your functions directory.
! functions: Please note that there will be breaking changes when you upgrade.
i functions: Loaded environment variables from .env.prod.
! functions: You are using an old version of firebase-functions SDK (3.15.7). Please update
firebase-functions SDK to >=3.20.0
i functions: preparing functions directory for uploading...
i functions: packaged E:\FlutterProjects\pegasus\functions (218.61 KB) for uploading
Error: Failed to fetch Run service undefined
I had the same issue and it was fixed for me when installed the latest firebase tools我遇到了同样的问题,在安装最新的 firebase 工具时已为我修复
npm install -g firebase-tools npm 安装-g firebase-tools
This was also fixed automatically by upgrading the version of firebase-tools using the command npm install -g firebase-tools.
这也通过使用命令
npm install -g firebase-tools.
You can add the --force flag if you encounter the below error如果遇到以下错误,可以添加 --force 标志
npm ERR! code EEXIST
npm ERR! path /usr/local/bin/firebase
npm ERR! EEXIST: file already exists
npm ERR! File exists: /usr/local/bin/firebase
You need to update your firebase-tools.您需要更新您的 firebase 工具。 Run npm install -g firebase-tools.
运行 npm install -g firebase-tools。
You may also need to re-source your terminal.您可能还需要重新获取您的终端。 I checked my version after
npm i -g firebase-tools
and it still wasn't 11.18.0 but did a source ~/.zshrc
and it fixed the issue.我在
npm i -g firebase-tools
之后检查了我的版本,它仍然不是 11.18.0 但做了一个source ~/.zshrc
.zshrc 并解决了这个问题。
Make sure you execute npm install -g firebase-tools
in the functions folder.确保在函数文件夹中执行
npm install -g firebase-tools
。
When you're using Firebase Tools with a version that is less than or equal to v11.18.0
, you might encounter the following error:当您使用版本低于或等于
v11.18.0
的 Firebase 工具时,您可能会遇到以下错误:
Error: Failed to fetch Run service undefined
错误:无法获取未定义的运行服务
The first thing that you should take into consideration is to update to a version that is newer than or equal to v11.18.0
.您应该考虑的第一件事是更新到高于或等于
v11.18.0
的版本。 By the time I'm answering this question, the latest version is 11.20.0
.当我回答这个问题时,最新版本是
11.20.0
。
Furthermore, install the latest Firebase tools by using the following line of code in your terminal:此外,在终端中使用以下代码行安装最新的 Firebase 工具:
npm install -g firebase-tools --force
npm audit fix
PS It's also recommended to update Firebase Function to the latest available version which now it's 4.1.1
. PS 还建议将 Firebase Function 更新到最新的可用版本,现在是
4.1.1
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.