gpt4 book ai didi

node.js - 基于Firebase功能的云通用 Angular 超时

转载 作者:行者123 更新时间:2023-12-02 21:32:21 25 4
gpt4 key购买 nike

我在firebase上部署了Angular Universal项目,并使用firebase函数为服务器端提供服务,也使用云构建触发了构建,尽管有时它只是一直重试,但它只是停留在服务器构建命令中以提供 Angular 通用性的问题,在本地工作,但在云上有时无法通过其他时间
云构建YAML

steps:
- name: 'gcr.io/cloud-builders/docker'
args: [ 'build', '-t' , 'gcr.io/$PROJECT_ID/firebase' , './dockerfiles/firebase']
- name: 'gcr.io/$PROJECT_ID/firebase'
args: [ 'use', '$_PROJECT_NAME','--token', '${_FIREBASE_TOKEN}']
- name: 'node:12.18.3'
entrypoint: npm
args: ['install']
- name: 'node:12.18.3'
entrypoint: npm
args: ['install','--prefix','functions']
- name: 'node:12.18.3'
entrypoint: npm
args: ['link']
- name: 'node:12.18.3'
entrypoint: npm
dir: 'functions'
args: ['install','-g', 'firebase-tools@latest']
- name: 'node:12.18.3'
entrypoint: npm
args: ['run-script','stage-browser']
- name: 'node:12.18.3'
entrypoint: npm
args: ['run-script','--debug','stage-server']
- name: 'node:12.18.3'
entrypoint: npm
dir: 'functions'
args: ['run-script','copyAndRename']
- name: 'gcr.io/$PROJECT_ID/firebase'
args: [ 'deploy','--debug', '--token', '${_FIREBASE_TOKEN}']
timeout: 2000s
Firebase Docker文件
FROM node:carbon

RUN npm install -g firebase-tools@latest

ENTRYPOINT ["/usr/local/bin/firebase"]
构建日志,它停留在这里的时间太长了,无法在此处添加
https://justpaste.it/30aoi
运行脚本命令
    "stage-browser": "node --max_old_space_size=16384 ./node_modules/@angular/cli/bin/ng build --prod --configuration=stage --aot --vendor-chunk --common-chunk --delete-output-path",
"stage-server": "node --max_old_space_size=16384 ./node_modules/@angular/cli/bin/ng run sf-mini:server:stage",
"copyAndRename": "node cp-angular.js",

最佳答案

根据错误消息,这可能是由于云构建在VM中创建的执行步骤的权限所致。
为了避免出现这些权限问题,您可以做的是使用sudo调用命令
当使用sudo时,它会像这样:

- name: 'gcr.io/cloud-builders/docker'
args: [ 'build', '-t' , 'gcr.io/$PROJECT_ID/firebase' , './dockerfiles/firebase']
- name: 'gcr.io/$PROJECT_ID/firebase'
args: [ 'use', '$_PROJECT_NAME','--token', '${_FIREBASE_TOKEN}']
- name: 'node:12.18.3'
entrypoint: bash
args: ['sudo','npm','install']
- name: 'node:12.18.3'
entrypoint: bash
args: ['sudo','npm','install','--prefix','functions']
- name: 'node:12.18.3'
entrypoint: bash
args: ['sudo','npm','link']
- name: 'node:12.18.3'
entrypoint: bash
dir: 'functions'
args: ['sudo','npm','install','-g', 'firebase-tools@latest']
- name: 'node:12.18.3'
entrypoint: bash
args: ['sudo','npm','run-script','stage-browser']
- name: 'node:12.18.3'
entrypoint: bash
args: ['sudo','npm','run-script','--debug','stage-server']
- name: 'node:12.18.3'
entrypoint: bash
dir: 'functions'
args: ['sudo','npm','run-script','copyAndRename']
- name: 'gcr.io/$PROJECT_ID/firebase'
args: [ 'deploy','--debug', '--token', '${_FIREBASE_TOKEN}']
timeout: 2000s

关于node.js - 基于Firebase功能的云通用 Angular 超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64163117/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com