webcontainer-core icon indicating copy to clipboard operation
webcontainer-core copied to clipboard

`nuxt preview` not working anymore after `nuxt generate`

Open codeflorist opened this issue 1 year ago • 9 comments

Describe the bug

Currently, when running nuxt preview to preview a nuxt application built with nuxt generate, the following error is thrown:

 ERROR  Command failed with exit code 13: npx serve ./public                                                                            11:06:18

  at makeError (node_modules/nuxi/dist/chunks/index3.mjs:1292:11)
  at handlePromise (node_modules/nuxi/dist/chunks/index3.mjs:2530:26)
  at async Object.run (node_modules/nuxi/dist/chunks/preview.mjs:141:5)
  at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.9edf0930.mjs:1678:16)
  at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.9edf0930.mjs:1669:11)
  at async runMain$1 (node_modules/nuxi/dist/shared/nuxi.9edf0930.mjs:1807:7) 

This was definitely working a while (maybe 2-3 weeks) ago. I also don't think that a Nuxt-update caused this, since the current Nuxt version (v3.11.2) came out more than a month ago, and i definitely had stackblitzes like this working in the meantime. I also tried with v3.11.1 and it has the same problem.

It is worth noting, that it is still working using nuxt build instead of nuxt generate.

Link to the blitz that caused the error

https://stackblitz.com/edit/nuxt-starter-zrndgf?file=package.json

Steps to reproduce

  1. launch the stackblitz
  2. i have the startCommand set to npm run generate && npm run preview, so you just have to press y when asked to install the serve package.

Expected behavior

No error being thrown - instead the generated site should be served.

Parity with Local

Screenshots

No response

Platform

Browser name  = Chrome
Full version  = 124.0.0.0
Major version = 124
navigator.appName = Netscape
navigator.userAgent = Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36
performance.memory = {
  "totalJSHeapSize": 93891146,
  "usedJSHeapSize": 75402534,
  "jsHeapSizeLimit": 4294705152
}
Hash = 34455753

Additional context

No response

codeflorist avatar May 08 '24 09:05 codeflorist

Hey @codeflorist 👋 . Thanks for reaching out!

I opened your project and it seems to work for me. Can you maybe try again and see if it's fixed in the mean time? We did release a new Node.js version with some additional fixes so it might have (accidentally) fixed it.

SamVerschueren avatar Jun 13 '24 06:06 SamVerschueren

Hey @codeflorist 👋 . Thanks for reaching out!

I opened your project and it seems to work for me. Can you maybe try again and see if it's fixed in the mean time? We did release a new Node.js version with some additional fixes so it might have (accidentally) fixed it.

@SamVerschueren

Thanks for taking a look!

I just tried https://stackblitz.com/edit/nuxt-starter-zrndgf?file=package.json again, and the same error is thrown.

I tried in Chrome as well as Firefox (Windows 11).

It's weird, that it is working with you.

One additional note: After booting up, the procedure halts at:

Need to install the following packages:
[email protected]
Ok to proceed? (y) 

There you have to press y, since the nuxt preview command requires the serve package.

codeflorist avatar Jun 13 '24 09:06 codeflorist

Hey @codeflorist !

Yes, I did press y and enter. I don't have to do anything else besides opening the project and then pressing y when it asks for it? The only thing I can think off is that you're running on Windows 🤔 . I might need to ask someone else from the team to test this on a Windows machine.

image

SamVerschueren avatar Jun 13 '24 09:06 SamVerschueren

here is a screenshot from me in a chrome inkognito window: image

codeflorist avatar Jun 13 '24 10:06 codeflorist