简体   繁体   English

无法部署 Firebase 函数(无法获取未定义的运行服务)

[英]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.

相关问题 Firebase 错误:无法获取未定义的运行服务 - Firebase Error: Failed to fetch Run service undefined Firebase 函数:无法读取未定义的属性 https - Firebase functions: Can not read property https of undefined 我无法测试 firebase 函数,因为 `TypeError: Cannot read properties of undefined (reading 'DataSnapshot')` - I can't test firebase functions because of `TypeError: Cannot read properties of undefined (reading 'DataSnapshot')` Firebase 部署功能 - 无法更新功能 - Firebase Admin this.appStore?.removeApp(this.name); - Firebase Deploy Functions - Failed to update function - Firebase Admin this.appStore?.removeApp(this.name); 使用云构建部署云功能失败:错误:未能获得 firebase 项目 - deploy cloud functions using cloud build failed: Error: failed to get firebase project Firebase 远程配置:无法读取任何值,但获取成功 - Firebase Remote Config: Can't read any values, but fetch is successful Firebase 云函数部署错误 - 超出配额 - Firebase Cloud Functions Deploy Error - Quota Exceeded 我们不能在 Firebase Cloud Functions 中写入多个文件吗 - Can't we Write multiple files in Firebase Cloud Functions Gitlab 云运行部署成功但作业失败 - Gitlab Cloud run deploy successfully but Job failed 使用“firebase deploy”部署到托管 - firebase 如何知道它是部署到托管而不是云功能? - using "firebase deploy" to deploy to hosting - how does firebase know if it is deploying to hosting and not cloud functions?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM