Next.js Discord

Discord Forum

[custom formatter threw an exception] when using bun

Answered
English Shepherd posted this in #help-forum
Open in Discord
English ShepherdOP
First, i was trying to build my website with bun then the [custom formatter threw an exception] error occured.
bunx --bun next build
   ▲ Next.js 15.0.2
   - Environments: .env

   Creating an optimized production build ...
 ✓ (serwist) Bundling the service worker script with the URL '/sw.js' and the scope '/'...
 ✓ Compiled successfully

./components/typewriter.tsx
45:6  Warning: React Hook useEffect has a missing dependency: 'animate'. Either include it or remove the dependency array.  react-hooks/exhaustive-deps

./lib/spam.ts
56:1  Warning: Assign instance to a variable before exporting as module default  import/no-anonymous-default-export

./lib/egm.ts
53:1  Warning: Assign instance to a variable before exporting as module default  import/no-anonymous-default-export

info  - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
 ✓ Linting and checking validity of types
   Collecting page data  ...[custom formatter threw an exception]

> Build error occurred
[custom formatter threw an exception]

Then, i tried without the --bun argument (bunx next build) and it worked. But when i run my website with bunx --bun next start it works, but when i enter a page that was working it doesnt work. (500 Internal Server Error) and it prints ⨯ [custom formatter threw an exception]
Answered by English Shepherd
I've had to use node.js to build
View full answer

10 Replies

English ShepherdOP
I've had to use node.js to build
Answer
These are eslint warnings
You can disable rules for that specific line.
also install eslint Vscode extensions if not already
Australian Freshwater Crocodile
This happens when running nextjs start with bun and there's any error. The page shows that an error has occured and that it cannot include the details except a digest, except, you can't see the digest output because it show "Custom Formatter threw an exception"
There's no issue with nodejs.
thats a issue with custom formatter. can you send your eslint config
simply put, bun does not run nextjs well yet. so use nodejs