Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nitro Build gets stuck at "You can preview this build using node .output/server/index.mjs" and doesn't complete when using nuxt-content-assets #49

Closed
brunopbarbosa opened this issue Sep 12, 2023 · 11 comments · Fixed by #65
Labels
bug Something isn't working external Waiting on an external or upstream dependency fix

Comments

@brunopbarbosa
Copy link

Background

Using this module to serve relative images with nuxt content, runs as expected while in dev.

Issue

When running npm run build (both on server or local) with the module enabled on the nuxt.config file, the build goes all the way through until this point and then just hangs indefinitely.

removing this module from the module list in the config file seems to let the build run as normal.

Any insight would be highly appreciated!

@davestewart
Copy link
Owner

davestewart commented Sep 14, 2023

Hello,

Sorry to leave you hanging! (EDIT: literally 😆)

What version of Nuxt are you running (run the code below to find out) ?

echo -e "\nNode `node -v`\n" && npm list nuxt @nuxt/content nuxt-content-assets --depth=0

If > 3.6.5 it could be related to this:

Can you confirm?

See also the linked issue 169. Right now it seems a few modules are causing this, the cause is not yet known, but I suspect it's something to do with Nuxt > 3.7.0.

@davestewart davestewart added bug Something isn't working external Waiting on an external or upstream dependency fix labels Sep 14, 2023
davestewart added a commit that referenced this issue Sep 14, 2023
@Hecatron
Copy link

Run into this problem myself under windows.
Fixing the nuxt version to 3.6.5 fixed it, it does appear to be a 3.7 issue

@brunopbarbosa
Copy link
Author

Hi, yes, i downgraded to 3.6.5 and it does in fact solve it!

I'll be keeping an eye out on those other issues you mentioned, at the moment fixing on 3.6.5 is not problematic.

And thanks again for your help! I didn't have to hang for too long 😆

I'll leave the issue open in case someone else ends up here, but feel free to close it if you think it's more appropriate!

@davestewart
Copy link
Owner

Whoop!

Yes, let's leave it open until it – hopefully – gets solved upstream.

Thanks for reporting back!

@davestewart
Copy link
Owner

davestewart commented Sep 16, 2023

This issue is now being tracked in the Nuxt CLI repo:

@Hecatron
Copy link

I think I've found a temporary workaround that allows us to use the latest version of nuxt with this module
Based on these links

I tried adding the following to the nuxt config

export default defineNuxtConfig({
  hooks: {
    close: (nuxt) => {
      if (!nuxt.options._prepare)
        process.exit()
    }
  }
})

Then I run nuxi generate and it all seems to work / finish under nuxt 3.8.1
not ideal but at least I think we can use the latest nuxt until there's a better fix

KristofVDB1 added a commit to Informatievlaanderen/OSLO-Standaardenregister that referenced this issue Nov 28, 2023
@ayZagen
Copy link

ayZagen commented Dec 1, 2023

@Hecatron that resolves the issue but is there any downside using it?

@Hecatron
Copy link

Hecatron commented Dec 1, 2023

I don't think so but I can't be 100% certain, for now it's a sort of temporary fix until nuxt sort they're end out, since I think it's not the only module it affects

@miclgael
Copy link

miclgael commented Mar 8, 2024

I'm not sure if related / useful but one potential downside to the workaround is I had to add an env check in order to keep Vitest working with @nuxt/test-utils

nuxt.config.{js|ts}

export default defineNuxtConfig({
  hooks: {
    close: (nuxt) => {
+     const isTesting = process.env.NODE_ENV === 'test'
+     if (!nuxt.options._prepare && !isTesting) {
         process.exit()
    }
  }
})

package.json

"scripts": {
+  "test": "NODE_ENV=test && vitest"
 }

This stops Vitest outputting nothing to the console.

Also noticed this message when running Vitest.

[Content Assets] Your browser does not support WebSocket

PS absolutely adore this module thank you for making it 🙏

KristofVDB1 added a commit to Informatievlaanderen/OSLO-publications-service that referenced this issue Mar 9, 2024
@YanDevDe
Copy link

I'm also facing the issue of where I use yarn install gets stuck at "✔ Types generated in .nuxt "

with the temporary solution of "hooks" in nuxt.config.ts seems to fix for yarn build, but for yarn install its still there.

I have following versions:

├── @nuxt/content@2.12.1
├── nuxt-content-assets@1.3.3
└── nuxt@3.7.4

@danielroe
Copy link
Contributor

danielroe commented Mar 20, 2024

The issue here, as explained in nuxt/cli#169 (comment), is that watchers were not being closed out.

I've made a couple of changes to close watchers gracefully when Nuxt exits, as well as avoiding starting some of them in the first place when not in development mode.

I hope this helps (#65). 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working external Waiting on an external or upstream dependency fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants