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.
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.
Can someone please tell me what is the proper way to deploy Vue.js application to Google App Engine?
There are a lot of services you can use to deploy your Vue JS application some of these places include: Git platforms such as GitHub Pages, GitLab Pages, and Bitbucket Pages, other platforms include Firebase hosting, Heroku, Digital Ocean, AWS solutions, CloudFront, Now and Surge and many more.
Let's host the Vue app on shared hosting! All we need to do is to execute npm run build command in the project folder. The command will then generate a dist directory that will consist of the files of our application. Then we will have to upload the whole folder to the hosting.
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.
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:
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
and
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"
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:
npm install
npm run build
gcloud app deploy
You have too many files in the project.
In your app.yaml
file, add the skip_files
tag to it so the deployment does not include unnecessary files or folder in the upload. You can also mix with regex so for example:
skip_files:
- node_modules/
- .gitignore
- src/
- public/
- babel.config.js
- ^(.*/)?\..*$
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With