google-app-engine - 如何在 Google App Engine 上部署 Vue.js 应用程序?

标签 google-app-engine vue.js

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

然后我使用 gcloud app deploy 命令将其部署到 Google App Engine,但随后部署停止并出现错误:

错误:(gcloud.app.deploy) INVALID_ARGUMENT:此部署文件过多。此应用的新版本限制为 10000 个文件。

谁能告诉我将 Vue.js 应用程序部署到 Google App Engine 的正确方法是什么?

最佳答案

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

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

  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

    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 中隐含的步骤,这意味着:

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

关于google-app-engine - 如何在 Google App Engine 上部署 Vue.js 应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55260646/

相关文章:

javascript - 如何将货币实现为静态类?

html - 我想让Rule msg动态VueJS

javascript - 路由嵌套数组后Vue js不渲染

java - 如何使用 Java 查询数据存储以获取子对象并比较它们的属性?

google-app-engine - GAE : Send email from any arbitrary email address in Google Apps domain

google-app-engine - 如何激活 App Engine 上的交互式控制台?

android - 将来自 Android 应用程序的数据存储在 App Engine 数据存储区中

python - App Engine 正则表达式问题将 URL 定向到脚本和处理程序

vue.js - webpack-modernizr-loader 使用 Vue CLI 3 加载器

javascript - Vue.js - 如何访问外部 Javascript/Jquery 函数