我有这个反应应用程序,我需要通过谷歌云构建部署到谷歌云存储中,我试图添加一个cloudbuild.yaml并添加一些步骤来运行npm
这就是我所拥有的:
steps:
- name: bash
script: |
npm install --force
- name: bash
script: |
npm run build
- name: "gcr.io/google.com/cloudsdktool/cloud-sdk"
entrypoint: gcloud
args:
["storage", "cp", "/dist/*", "gs://bucket"]
timeout: 1200s
options:
logging: CLOUD_LOGGING_ONLY
但是云构建向我显示错误:
Step #0: script: line 2: npm: not found
在您的步骤中,您使用
name: bash
,因此您使用安装了 bash 的容器,而不是 NPM。
例如使用容器名称“node:19”来获取符合node/npm标准的容器并能够调用NPM。