Build fails after updating to Nuxt 4.2.0
Anyone have problems buildin with 4.2? We're building in docker but the build step fails right away with this error message:
#12 6.919 ERROR ✗ Build failed in 42ms
#12 6.919
#12 6.920
#12 6.920 [nuxi] ERROR Nuxt Build Error: Build failed with 1 error:
#12 6.920
#12 6.920 [31m[UNRESOLVED_ENTRY] Error:[0m Cannot resolve entry module node_modules/nuxt/dist/app/entry.js.
#12 6.920
#12 6.920
#12 6.920 at aggregateBindingErrorsIntoJsError (node_modules/rolldown/dist/shared/src-BwxUhqZU.mjs:2627:18)
#12 6.920 at unwrapBindingResult (node_modules/rolldown/dist/shared/src-BwxUhqZU.mjs:2602:128)
#12 6.920 at RolldownBuild.write (node_modules/rolldown/dist/shared/src-BwxUhqZU.mjs:4394:33)
#12 6.920 at async buildEnvironment (node_modules/vite/dist/node/chunks/node.js:33446:64)
#12 6.920 at async Object.build (node_modules/vite/dist/node/chunks/node.js:33849:19)
#12 6.920 at async buildClient (node_modules/@nuxt/vite-builder/dist/index.mjs:1164:5)
#12 6.920 at async handleSerialBuilds (node_modules/@nuxt/vite-builder/dist/index.mjs:2250:3)
#12 6.920 at async bundle (node_modules/@nuxt/vite-builder/dist/index.mjs:2217:5)
#12 6.920 at async bundle (node_modules/nuxt/dist/index.mjs:6925:5)
#12 6.920 at async build (node_modules/nuxt/dist/index.mjs:6785:3)
#12 6.920 at async Object.run (node_modules/@nuxt/cli/dist/build-CVr-ruAe.mjs:67:3)
#12 6.920 at async runCommand (node_modules/citty/dist/index.mjs:316:16)
#12 6.920 at async runCommand (node_modules/citty/dist/index.mjs:307:11)
#12 6.920 at async runMain (node_modules/citty/dist/index.mjs:445:7)
#12 6.920 #12 ERROR: process "/bin/sh -c npm run build-production" did not complete successfully: exit code: 1
------
[8/8] RUN npm run build-production:6.920 at async buildClient (node_modules/@nuxt/vite-builder/dist/index.mjs:1164:5) 6.920 at async handleSerialBuilds (node_modules/@nuxt/vite-builder/dist/index.mjs:2250:3) 6.920 at async bundle (node_modules/@nuxt/vite-builder/dist/index.mjs:2217:5) 6.920 at async bundle (node_modules/nuxt/dist/index.mjs:6925:5) 6.920 at async build (node_modules/nuxt/dist/index.mjs:6785:3) 6.920 at async Object.run (node_modules/@nuxt/cli/dist/build-CVr-ruAe.mjs:67:3) 6.920 at async runCommand (node_modules/citty/dist/index.mjs:316:16) 6.920 at async runCommand (node_modules/citty/dist/index.mjs:307:11) 6.920 at async runMain (node_modules/citty/dist/index.mjs:445:7) 6.920
2 Replies
Hi @Liek2Saev. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Based on the knowledge sources, there are several known issues with Nuxt 4.2.0 builds, particularly on Windows and when using certain configurations. Your error appears to be related to the rolldown build system not being able to resolve the entry module.
Known Issues and Solutions
1. VueUse Compatibility Issue
The most relevant issue to your error is related to @vueuse/core version 14.0.0+. According to the Can't build on Windows issue, there's a problem with VueUse 14.0.0 that causes build failures with errors like:
One user reported: "I believe this is actually an issue caused by
@vueuse changing to compiling with tsdown. When I downgrade vueuse from 14.0.0 to 13.9.0 it works as expected, looks like rollup can't handle the $1 in window$1 when parsing the AST."
Solution: Try downgrading @vueuse/core to version 13.9.0 if you're using it.
2. Node Version Issues
Several users reported that updating to a newer Node.js version resolved build issues. From the Can't install Nuxt 4.1.3 on linux issue:
- Users with older versions of Node 20 or Node 22 experienced issues
- Updating to Node 22.20.0 or later resolved the problems
Solution: Ensure you're using Node.js version 22.20.0 or later in your Docker container.
3. Rolldown-Vite Issues
There are known issues with the rolldown-vite integration in Nuxt 4.1.3+. The Nuxt >=4.1.3 broken on cb2b9d5 issue mentions problems with the rolldown replace plugin.
4. Temporary Workaround
If the above solutions don't work, you could temporarily downgrade to Nuxt 4.1.2, which several users confirmed works correctly:
5. Docker-Specific Considerations
From the Docker Build Problem Stack Overflow post, ensure you have a proper .dockerignore file to prevent copying local node_modules into your Docker container, which can cause build issues.
I recommend trying these solutions in order: update Node.js version, check VueUse version, and if necessary, temporarily downgrade to Nuxt 4.1.2 while the issues are being resolved.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@252030467040083979> Kapa.ai is still learning and improving, please let me know how I did by reacting below.