N
Nuxt5d ago
nuffsaid

npm run build crashes after upgrade to Nuxt 3.16 due to exsolve

after upgrading to Nuxt 3.16 (from Nuxt 3.15) npm run build suddenly breaks with errors in the exsolve module. In my application code (so outside of node_modules) I do not use any node functionality (directly). All I receive is this rather cryptic message of an error caused within exsolve itself. Did anyone else have this problem after the upgrade and how did you solve it? Thanks a lot for any pointers!
[ nuxi 15:58:23] ERROR Nuxt Build Error: node_modules/exsolve/dist/index.mjs (7:9): "format" is not exported by "__vite-browser-external", imported by "node_modules/exsolve/dist/index.mjs".
file: /Users/someuser/someproject/node_modules/exsolve/dist/index.mjs:7:9

5: import process$1 from 'node:process';
6: import v8 from 'node:v8';
7: import { format, inspect } from 'node:util';
^
8:
9: const nodeBuiltins = [


at getRollupError (node_modules/rollup/dist/es/shared/parseAst.js:397:41)
at error (node_modules/rollup/dist/es/shared/parseAst.js:393:42)
at Module.error (node_modules/rollup/dist/es/shared/node-entry.js:16750:16)
at Module.traceVariable (node_modules/rollup/dist/es/shared/node-entry.js:17199:29)
at ModuleScope.findVariable (node_modules/rollup/dist/es/shared/node-entry.js:14855:39)
at FunctionScope.findVariable (node_modules/rollup/dist/es/shared/node-entry.js:5583:38)
at FunctionBodyScope.findVariable (node_modules/rollup/dist/es/shared/node-entry.js:5583:38)
at Identifier.bind (node_modules/rollup/dist/es/shared/node-entry.js:5357:40)
at CallExpression.bind (node_modules/rollup/dist/es/shared/node-entry.js:2780:28)
at CallExpression.bind (node_modules/rollup/dist/es/shared/node-entry.js:11935:15)
[ nuxi 15:58:23] ERROR Nuxt Build Error: node_modules/exsolve/dist/index.mjs (7:9): "format" is not exported by "__vite-browser-external", imported by "node_modules/exsolve/dist/index.mjs".
file: /Users/someuser/someproject/node_modules/exsolve/dist/index.mjs:7:9

5: import process$1 from 'node:process';
6: import v8 from 'node:v8';
7: import { format, inspect } from 'node:util';
^
8:
9: const nodeBuiltins = [


at getRollupError (node_modules/rollup/dist/es/shared/parseAst.js:397:41)
at error (node_modules/rollup/dist/es/shared/parseAst.js:393:42)
at Module.error (node_modules/rollup/dist/es/shared/node-entry.js:16750:16)
at Module.traceVariable (node_modules/rollup/dist/es/shared/node-entry.js:17199:29)
at ModuleScope.findVariable (node_modules/rollup/dist/es/shared/node-entry.js:14855:39)
at FunctionScope.findVariable (node_modules/rollup/dist/es/shared/node-entry.js:5583:38)
at FunctionBodyScope.findVariable (node_modules/rollup/dist/es/shared/node-entry.js:5583:38)
at Identifier.bind (node_modules/rollup/dist/es/shared/node-entry.js:5357:40)
at CallExpression.bind (node_modules/rollup/dist/es/shared/node-entry.js:2780:28)
at CallExpression.bind (node_modules/rollup/dist/es/shared/node-entry.js:11935:15)
2 Replies
kapa.ai
kapa.ai5d ago
Hi @nuffsaid. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- This issue appears to be related to the recent update of the exsolve module in Nuxt 3.16, which is causing build errors. Based on the knowledge sources, there are a few relevant points that might help explain and resolve your problem. What's happening In Nuxt 3.16, there was a migration to use exsolve for module resolution as part of a performance improvement. This is documented in PR #31124, where Nuxt migrated to use exsolve for faster module resolution. Additionally, there was an update of the exsolve dependency from version ^0.4.4 to ^1.0.1 as seen in PR #31141. The error you're seeing is related to Node.js built-in modules being imported in a browser context during the build process, specifically the node:util module. Possible solutions Based on similar issues reported after upgrading to Nuxt 3.16, here are some approaches that might help: 1. Update all Nuxt-related packages: Several users reported that updating related packages like @nuxt/scripts resolved similar issues. Make sure all your Nuxt ecosystem packages are updated to compatible versions. 2. Try adding the problematic module to Vite's optimization exclusions:
// nuxt.config.ts
export default defineNuxtConfig({
vite: {
optimizeDeps: {
exclude: ['exsolve'], // Exclude exsolve from optimization
},
},
})

// nuxt.config.ts
export default defineNuxtConfig({
vite: {
optimizeDeps: {
exclude: ['exsolve'], // Exclude exsolve from optimization
},
},
})

3. Downgrade to Nuxt 3.15.4: Some users reported in issue #28850 that downgrading to Nuxt 3.15.4 resolved similar build errors. 4. Check for module resolution conflicts: The error suggests there might be conflicts in how Node.js built-in modules are being resolved. This could be related to your package manager or hoisting configuration if you're using pnpm. 5. Clear caches and reinstall dependencies: As mentioned in issue #29744, sometimes clearing caches and reinstalling dependencies can help resolve unexpected build errors after updates. This appears to be one of several issues that users have encountered after upgrading to Nuxt 3.16, with various module resolution and export-related errors being reported. The Nuxt team is likely aware of these issues and working on fixes for future patch releases. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai5d ago
<@729689110813343744> Kapa.ai is still learning and improving, please let me know how I did by reacting below.

Did you find this page helpful?