cli: nuxi `prepare` or `build` hangs

Environment


  • Operating System: Darwin
  • Node Version: v20.5.1
  • Nuxt Version: 3.7.0
  • CLI Version: 3.7.0
  • Nitro Version: 2.6.1
  • Package Manager: npm@9.8.0
  • Builder: -
  • User Config: experimental, css, ssr, nitro, app, modules, devtools
  • Runtime Modules: @pinia/nuxt@0.4.11, @nuxt/content@2.7.2, @vueuse/nuxt@10.4.0, @vuestic/nuxt@1.0.14
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-khexbq?file=package.json

Describe the bug

image

Doing a npm install stucks at the above position , doing a npx nuxi upgrade --force fixes the issue, Conflicting during deploying .

image

Additional context

No response

### Logs

+ npm install

npm WARN ERESOLVE overriding peer dependency

npm WARN While resolving: @scaleflex/icons@1.0.0-beta.99

npm WARN Found: react@18.2.0

npm WARN node_modules/react

npm WARN   react@"18.2.0" from filerobot-image-editor@4.5.1

npm WARN   node_modules/filerobot-image-editor

npm WARN     filerobot-image-editor@"^4.5.1" from the root project

npm WARN   12 more (react-konva, styled-components, its-fine, ...)

npm WARN 

npm WARN Could not resolve dependency:

npm WARN peer react@"^16.13.1" from @scaleflex/icons@1.0.0-beta.99

npm WARN node_modules/@scaleflex/icons

npm WARN   @scaleflex/icons@"^1.0.0-beta.99" from @scaleflex/ui@1.0.0-beta.99

npm WARN   node_modules/@scaleflex/ui

npm WARN   1 more (react-filerobot-image-editor)

npm WARN 

npm WARN Conflicting peer dependency: react@16.14.0

npm WARN node_modules/react

npm WARN   peer react@"^16.13.1" from @scaleflex/icons@1.0.0-beta.99

npm WARN   node_modules/@scaleflex/icons

npm WARN     @scaleflex/icons@"^1.0.0-beta.99" from @scaleflex/ui@1.0.0-beta.99

npm WARN     node_modules/@scaleflex/ui

npm WARN     1 more (react-filerobot-image-editor)

npm WARN ERESOLVE overriding peer dependency

npm WARN While resolving: @scaleflex/icons@1.0.0-beta.99

npm WARN Found: react-dom@18.2.0

npm WARN node_modules/react-dom

npm WARN   react-dom@"18.2.0" from filerobot-image-editor@4.5.1

npm WARN   node_modules/filerobot-image-editor

npm WARN     filerobot-image-editor@"^4.5.1" from the root project

npm WARN   5 more (react-konva, styled-components, ...)

npm WARN 

npm WARN Could not resolve dependency:

npm WARN peer react-dom@"^16.13.1" from @scaleflex/icons@1.0.0-beta.99

npm WARN node_modules/@scaleflex/icons

npm WARN   @scaleflex/icons@"^1.0.0-beta.99" from @scaleflex/ui@1.0.0-beta.99

npm WARN   node_modules/@scaleflex/ui

npm WARN   1 more (react-filerobot-image-editor)

npm WARN 

npm WARN Conflicting peer dependency: react-dom@16.14.0

npm WARN node_modules/react-dom

npm WARN   peer react-dom@"^16.13.1" from @scaleflex/icons@1.0.0-beta.99

npm WARN   node_modules/@scaleflex/icons

npm WARN     @scaleflex/icons@"^1.0.0-beta.99" from @scaleflex/ui@1.0.0-beta.99

npm WARN     node_modules/@scaleflex/ui

npm WARN     1 more (react-filerobot-image-editor)

npm WARN ERESOLVE overriding peer dependency

npm WARN While resolving: @scaleflex/ui@1.0.0-beta.99

npm WARN Found: react@18.2.0

npm WARN node_modules/react

npm WARN   react@"18.2.0" from filerobot-image-editor@4.5.1

npm WARN   node_modules/filerobot-image-editor

npm WARN     filerobot-image-editor@"^4.5.1" from the root project

npm WARN   12 more (react-konva, styled-components, its-fine, ...)

npm WARN 

npm WARN Could not resolve dependency:

npm WARN peer react@"^16.13.1" from @scaleflex/ui@1.0.0-beta.99

npm WARN node_modules/@scaleflex/ui

npm WARN   @scaleflex/ui@"1.0.0-beta.99" from react-filerobot-image-editor@4.5.1

npm WARN   node_modules/react-filerobot-image-editor

npm WARN 

npm WARN Conflicting peer dependency: react@16.14.0

npm WARN node_modules/react

npm WARN   peer react@"^16.13.1" from @scaleflex/ui@1.0.0-beta.99

npm WARN   node_modules/@scaleflex/ui

npm WARN     @scaleflex/ui@"1.0.0-beta.99" from react-filerobot-image-editor@4.5.1

npm WARN     node_modules/react-filerobot-image-editor

npm WARN ERESOLVE overriding peer dependency

npm WARN While resolving: @scaleflex/ui@1.0.0-beta.99

npm WARN Found: react-dom@18.2.0

npm WARN node_modules/react-dom

npm WARN   react-dom@"18.2.0" from filerobot-image-editor@4.5.1

npm WARN   node_modules/filerobot-image-editor

npm WARN     filerobot-image-editor@"^4.5.1" from the root project

npm WARN   5 more (react-konva, styled-components, ...)

npm WARN 

npm WARN Could not resolve dependency:

npm WARN peer react-dom@"^16.13.1" from @scaleflex/ui@1.0.0-beta.99

npm WARN node_modules/@scaleflex/ui

npm WARN   @scaleflex/ui@"1.0.0-beta.99" from react-filerobot-image-editor@4.5.1

npm WARN   node_modules/react-filerobot-image-editor

npm WARN 

npm WARN Conflicting peer dependency: react-dom@16.14.0

npm WARN node_modules/react-dom

npm WARN   peer react-dom@"^16.13.1" from @scaleflex/ui@1.0.0-beta.99

npm WARN   node_modules/@scaleflex/ui

npm WARN     @scaleflex/ui@"1.0.0-beta.99" from react-filerobot-image-editor@4.5.1

npm WARN     node_modules/react-filerobot-image-editor



> flydiz@1.0.0 postinstall

> nuxt prepare



[warn] Using experimental payload extraction for full-static output. You can opt-out by setting `experimental.payloadExtraction` to `false`.

[success] Types generated in .nuxt

About this issue

  • Original URL
  • State: open
  • Created 10 months ago
  • Reactions: 7
  • Comments: 34 (12 by maintainers)

Commits related to this issue

Most upvoted comments

Had the same issue; removing the ‘nuxt-content-assets’ module resolved it.

Just upgraded a project to the latest Nuxt 10.3 , and it builds locally but stalls on Netlify.

CleanShot 2024-02-16 at 15 23 19

However, adding the fix mentioned above allows Netlify to proceed to the build step, with seemingly no adverse effects:

// nuxt.config.ts
  hooks: {
    close: () => {
      // @see https://github.com/nuxt/cli/issues/169#issuecomment-1729300497
      // Workaround for https://github.com/nuxt/cli/issues/169
      process.exit(0)
    }
  },

As I understand from the other comments:

  • the stall is likely triggered (but not caused) by Nuxt Content Assets (I’m the author of this module)
  • however, it should be solved in the project’s config

@pi0 / @danielroe – what would be the best way for Nuxt Content Assets to mitigate this problem for its users?

  • It seems that it’s needed for some folks / environments but not others.
  • Is this something I can / should solve in the module, and should it be in code, or perhaps documentation?

I don’t understand the underlying mechanisms / reasons well enough to make that decision, so if you could make a recommendation I would appreciate it.

Thanks.

Nuxt Content Assets author here.

Happy to help if possible, but Nuxt development moves so quickly, I’m not sure I can.

@pi0 - any advice on where to look in my module?

For the time being, I’ll upgrade to Nuxt 2.8 in the module demo folder, and will create a new issue with the demo folder being the reproduction if it happens there.

@unitythemaker You can use process.static or import.meta.prerender static flags.

It looks like this problems can be caused by many libraries like vuestic, nuxt-content-assets and @nuxt/image. I’m prerendering sitemap in my project so it may be connected.

@danielroe I also have the same problem but I’m not using vuestic. Some core libs like nuxt/content, nuxt/image-edge, fontaine etc. The only third party package is ‘nuxt-content-assets’. Please let me know if you want me to create a separate issue for that.

This is caused by vuestic/nuxt registering a watcher, without signalling it to close. I’ve opened https://github.com/epicmaxco/vuestic-ui/pull/3748 to fix that.

@pi0, I think we should probably still exit nuxi even if watchers are still around - can you think what might be causing this?

@L422Y Thank you!! It was my own derpy fault for not understanding how Nuxt modules work or when they run. I added a chokidar.watch in a custom Nuxt module to re-compile SCSS files on changes, since in my case, they need to be pre-compiled as themes and swapped at runtime. I intended it just for dev mode, and didn’t realize the modules would run for something like nuxt prepare or nuxt build. I was able to fix it.

I feel like it might be useful to have some sort of “registry” of promises or long running timers so we could alert the user and even cleanly close them/time them out ofter generating. How bad would it be to extend/override/wrap the Promise class and timers to do this sort of thing?

I know this could have an effect on garbage collection, but the benefits might outweigh the negatives, and even enhance troubleshooting or debugging memory issues.

Same issue and I am not using vuestic/nuxt or nuxt-content-assets

(edit) I realized that removing the module nuxt-mongoose resolves this issue but I don’t know if is a problem of the module or how I implement it.

same problem with static used for some pages

I have the same problem but I’m not using @vuestic/nuxt. It’s stuck on:

postinstall

nuxt prepare

[success] Types generated in .nuxt