GoogleCloudPlatform/buildpacks

Nuxt.js application deployment failing

LukeSchlangen opened this issue · 3 comments

Describe the bug
I'm trying to deploy an Nuxt.js application to Cloud Run using Buildpacks. The build is successful, but the deployment is failing with the error:

$ nuxt start
FATAL No build files found in /workspace/.nuxt/dist/server.

Seems like it may be similar to #381

Additional context
How are you using GCP buildpacks?

  • pack and the gcr.io/buildpacks/builder
  • Cloud Functions
  • Cloud Run
  • Cloud Build
  • App Engine Standard
  • App Engine Flex

Did this used to work?
No

What language is your project primarily written in?
Node.js, Nuxt.js

Steps To Reproduce
Steps to reproduce the behavior:

  1. Create a new Nuxt.js project: https://nuxt.com/docs/getting-started/installation#new-project
  2. Deploy to Google Cloud with gcloud run deploy

Expected behavior
Successful deployment.

Actual behavior
Failed deployment with: FATAL No build files found in /workspace/.nuxt/dist/server.

I got tripped up originally in the documentation. This is for Nuxt2, and I don't think it should work out of the box. Closing for now.

I think we still need a fix for nuxt.

For Nuxt2 or Nuxt3?

For Nuxt3, we could add the start script node .output/server/index.mjs?

I did some digging based on Nuxt's installation and deployment docs.

This failed:

  1. npx nuxi@latest init nuxt-app
  2. cd nuxt-app
  3. gcloud run deploy

But I was able to deploy if I added node .output/server/index.mjs as the start script:

  1. npx nuxi@latest init nuxt-app
  2. cd nuxt-app
  3. npm pkg set scripts.start="node .output/server/index.mjs"
  4. gcloud run deploy

For detection, we could check for the presence of a nuxt.config.ts file or if nuxt in the package.json list of dependencies started with ^3. or 3.? Then if it is a vue3 project and there is no start script, we could run node .output/server/index.mjs?