简体   繁体   English

在 Google Cloud Platform 上部署 Vue Build

[英]Deploy Vue Build On Google Cloud Platform

I am running command "gcloud app deploy" from my "vue" app folder and at the last getting vue-cli error, attached snap for it.我正在从我的“vue”应用程序文件夹运行命令“gcloud app deploy”,最后得到 vue-cli 错误,附加了它的快照。

在此处输入图片说明

it seems like vue-cli-service isn't installed this is my cloudbuild.yaml if it helps steps:似乎没有安装 vue-cli-service 这是我的 cloudbuild.yaml 如果它有助于步骤:

- name: node
  entrypoint: npm
  args: ['install']
# Necessary for vue.js projects
- name: node
  entrypoint: npm
  args: ['install', '-g', '@vue/cli']
- name: node
  entrypoint: npm
  args: ['test']
- name: node
  entrypoint: npm
  args: ['run', 'build']
- name: "gcr.io/cloud-builders/gcloud"
  args: ["app", "deploy"]

app.yaml:应用程序.yaml:

runtime: nodejs12
handlers:
  # Serve all static files with urls ending with a file extension
- url: /(.*\..+)$ 
  static_files: dist/\1
  upload: dist/(.*\..+)$  # catch all handler to index.html
- url: /.*
  static_files: dist/index.html
  upload: dist/index.html

Note: if your package.json isn't in your repository root you should define set in npm commands as:注意:如果您的 package.json 不在您的存储库根目录中,您应该在 npm 命令中将 set 定义为:

    - name: node
      entrypoint: npm
   # --prefix and path:
      args: ['install','--prefix','myapp']

and for deployment in gcloud if app.yaml isn't in root either:如果 app.yaml 不在 root 中,则用于在 gcloud 中部署:

- name: "gcr.io/cloud-builders/gcloud"
  args: ["app", "deploy","myapp/app.yaml"]

Are you trying to deploy the app on GAE ( Google App Engine )?您是否尝试在 GAE ( Google App Engine ) 上部署应用程序?

If you are, the error might be caused because of GAE is not compatible with nodejs ( npm ), you need to deploy it in GAE flex if you want to use Vue of that way.如果是这样,可能是因为 GAE 与 nodejs ( npm ) 不兼容导致错误,如果您想以这种方式使用 Vue,则需要在 GAE flex 中部署它。

Another option could be, build the vue app and deploy it with another runtime, for example: python server;另一种选择是,构建 vue 应用程序并使用另一个运行时部署它,例如:python 服务器; using the build as a static site.使用构建作为静态站点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM