[英]Deploy cloud function using cloud build
This my package.json file这是我的 package.json 文件
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"scripts": {
"serve": "firebase emulators:start --only functions",
"shell": "firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"engines": {
"node": "16"
},
"main": "index.js",
"dependencies": {
"body-parser": "^1.20.0",
"firebase-admin": "^10.0.2",
"firebase-functions": "^3.18.0"
},
"devDependencies": {
"firebase-functions-test": "^0.2.0"
},
"private": true
}
And this is my cloudbuild.yaml这是我的cloudbuild.yaml
steps:
#Install
- name: 'gcr.io/cloud-builders/npm'
args: ['install']
enter image description here在此处输入图像描述
I am trying to deploy cloud functions using cloud build but I am not getting the hosting URL for my code.我正在尝试使用云构建部署云功能,但我的代码没有托管 URL。 Can anyone help me out?
谁能帮我吗?
The cloud build log details show that there is a npm WARN saveError ENOENT:no such file or directory, open '/workspace/package.json'
warning message.云构建日志详细信息显示有
npm WARN saveError ENOENT:no such file or directory, open '/workspace/package.json'
警告消息。
The log also has a package-lock.json file to try eliminate this warnings and saveError delete package-lock.json file and then install packages,日志中还有一个 package-lock.json 文件来尝试消除这个警告和 saveError 删除 package-lock.json 文件然后安装包,
rm package-lock.json && npm install
You can check a similar Stackoverflow question here .您可以在此处查看类似的 Stackoverflow 问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.