Abhishek Panchal
Abhishek Panchal

Reputation: 104

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.

enter image description here

Upvotes: 0

Views: 1216

Answers (2)

Kazzpa
Kazzpa

Reputation: 11

it seems like vue-cli-service isn't installed this is my cloudbuild.yaml if it helps steps:

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

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:

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

and for deployment in gcloud if app.yaml isn't in root either:

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

Upvotes: 1

Chaotic Pechan
Chaotic Pechan

Reputation: 964

Are you trying to deploy the app on 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.

Another option could be, build the vue app and deploy it with another runtime, for example: python server; using the build as a static site.

Upvotes: 0

Related Questions