google-app-engine - 如何在 Google App Engine 上部署 Vue.js 应用程序?
问题描述
我创建了一个简单的 Vue.js 应用程序。然后我使用在项目结构npm run build
中创建文件夹的命令 创建了一个用于生产的构建
。dist
然后我使用gcloud app deploy
命令将其部署到 Google App Engine,但随后部署停止并给出以下错误:
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 的正确方法是什么?
解决方案
您是否尝试过使用 Cloud Build 将 Vue.js 应用程序部署到 Google App Engine?我以这种方式部署任何 Vue.js 应用程序都没有问题。尝试按照本教程获取完整说明。
基本上,在通过 Cloud Build 将 Vue.js 应用程序部署到 Google App Engine 时,您必须在项目根目录中包含以下两个文件:
应用程序.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
和
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 中隐含的步骤,这意味着:
- 跑
npm install
- 跑
npm run build
- 跑
gcloud app deploy
推荐阅读
- python - python中列表的减法,优化速度
- system-verilog - FSM: Can't see output in waveform
- wpf - Workaround for dependency property value precendence
- php - How to display all rows from one table if there are no rows with matching criteria to count in second table
- perl - Cannot locate Config/General.pm Perl module in @INC?
- office-js - Office excel add-in is getting cropped when loaded in excel online and in excel Desktop
- android - CheckBox 和 CheckedTextView 的字不出现
- javascript - Read a text file with PHP and return it to JavaScript
- java - W/ChooserActivity: No activity found for Intent { act=com.instagram.share.ADD_TO_STORY
- r - R ggplot2 - 在所有面的顶部和右侧添加刻度