#buid error

1 messages · Page 1 of 1 (latest)

summer delta
#

D:\frontend\vercel\experiment>npm run build

stax@1.1.0 build
next build

(node:12548) [MODULE_TYPELESS_PACKAGE_JSON] Warning: Module type of file:///D:frontend/vercel/experiment/next.config.js is not specified and it doesn't parse as CommonJS.
Reparsing as ES module because module syntax was detected. This incurs a performance overhead.
To eliminate this warning, add "type": "module" to D:\Awais\metricoid-site\frontend\vercel\experiment\package.json.
(Use node --trace-warnings ... to show where the warning was created)
⚠ Invalid next.config.js options detected:
⚠ Unrecognized key(s) in object: 'optimizeFonts'
⚠ See more info here: https://nextjs.org/docs/messages/invalid-next-config
▲ Next.js 15.1.4

  • Environments: .env

Creating an optimized production build ...
(node:13852) [MODULE_TYPELESS_PACKAGE_JSON] Warning: Module type of file:///D:/Awais/metricoid-site/frontend/vercel/experiment/next.config.js is not specified and it doesn't parse as CommonJS.
Reparsing as ES module because module syntax was detected. This incurs a performance overhead.
To eliminate this warning, add "type": "module" to D:\Awais\metricoid-site\frontend\vercel\experiment\package.json.
(Use node --trace-warnings ... to show where the warning was created)
uncaughtException [Error: kill EPERM] { errno: -4048, code: 'EPERM', syscall: 'kill' }

getting this build error

somber crowBOT
#

Hi @summer delta. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Your build error contains two main issues:

1. Warning about next.config.js module type

You see this warning:

Warning: Module type of file:///D:/.../next.config.js is not specified and it doesn't parse as CommonJS.
Reparsing as ES module because module syntax was detected. This incurs a performance overhead.
To eliminate this warning, add "type": "module" to .../package.json.

This means your next.config.js is using ES module syntax (e.g., export default), but your project is not set up to use ES modules. You have two options:

  • If you want to use ES module syntax, rename your config to next.config.mjs and (optionally) add "type": "module" to your package.json.
  • If you want to use CommonJS, use module.exports = { ... } in next.config.js and do not use export default.

See the official docs for more details: Next.js Configuration<source><https://nextjs.org/docs/app/api-reference/config/next-config-js</source>.>

2. Invalid optimizeFonts Option

You have this warning:

Invalid next.config.js options detected: Unrecognized key(s) in object: 'optimizeFonts'

The optimizeFonts option is not recognized in Next.js 15.1.4. You should remove it from your next.config.js as it is no longer a valid configuration option. See the warning message and invalid next-config message<source><https://nextjs.org/docs/messages/invalid-next-config</source>.>

3. uncaughtException [Error: kill EPERM]

#

This error:

uncaughtException [Error: kill EPERM] { errno: -4048, code: 'EPERM', syscall: 'kill' }

is a Windows-specific permissions error. It can happen if your terminal does not have the necessary permissions. Try running your terminal as Administrator. This issue has been reported by other users and running the build script from an elevated terminal (right-click and "Run as administrator") can resolve it<source><https://github.com/vercel/next.js/issues/40760</source>.>


Summary of what to do:

  1. Remove the optimizeFonts key from your next.config.js.
  2. Make sure your config file uses the correct module syntax (either CommonJS with module.exports or ES module with next.config.mjs and export default).
  3. Run your terminal as Administrator to avoid the EPERM error on Windows.

If you follow these steps, your build should proceed without these errors.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@summer delta Kapa.ai is still learning and improving, please let me know how I did by reacting below.