如何在Google App Engine上部署Vue.js应用程序? [英] How to deploy Vue.js app on Google App Engine?

查看:88
本文介绍了如何在Google App Engine上部署Vue.js应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个简单的Vue.js应用程序.然后我创建了一个用于生产的构建 npm run build命令在项目结构中创建dist文件夹.

I created a simple Vue.js application. Then I created a build for production using npm run build command which creates dist folder in the project structure.

然后,我使用gcloud app deploy命令将其部署到Google App Engine,但是部署停止并显示错误消息:

Then I use gcloud app deploy command to deploy it to Google App Engine, but then the deployment stops and gives error as:

ERROR: (gcloud.app.deploy) INVALID_ARGUMENT: This deployment has too many files. New versions are limited to 10000 files for this app.

有人可以告诉我将Vue.js应用程序部署到Google App Engine的正确方法是什么吗?

Can someone please tell me what is the proper way to deploy Vue.js application to Google App Engine?

推荐答案

您是否尝试过使用Cloud Build将Vue.js应用部署到Google App Engine?我以这种方式部署任何Vue.js应用程序都没有问题.尝试按照本教程操作

Have you tried deploying your Vue.js app to Google App Engine using Cloud Build? I have had no problem deploying any Vue.js apps in this way. Try following this tutorial for complete instructions.

基本上,在通过Cloud Build将Vue.js应用部署到Google App Engine时,您必须在项目根目录中包含以下两个文件:

Basically, you would have to include the following two files in your project root directory when deploying your Vue.js app to Google App Engine via Cloud Build:

  1. App.yaml

  1. App.yaml

runtime: nodejs10
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

  1. cloudbuild.yaml

  1. cloudbuild.yaml

steps:
- name: node:10.15.1
  entrypoint: npm
  args: ["install"]
- name: node:10.15.1
  entrypoint: npm
  args: ["run", "build"]
- name: "gcr.io/cloud-builders/gcloud"
  args: ["app", "deploy"]
timeout: "1600s"

在不使用云构建的情况下,您可以只使用上面的app.yaml并引用cloudbuild.yaml中隐含的步骤,这意味着:

In the case you're not using cloud build you may just use the app.yaml above and reference the steps implied in the cloudbuild.yaml, which means:

  1. 运行npm install
  2. 运行npm run build
  3. 运行gcloud app deploy
  1. run npm install
  2. run npm run build
  3. run gcloud app deploy

这篇关于如何在Google App Engine上部署Vue.js应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆