Error when updating next.config.mjs
Unanswered
Little Egret posted this in #help-forum
Little EgretOP
My Nextjs development server is crashing every time I try to update my next.config.mjs file (error and code below). I'm trying to update my config to allow an external image source, but the issue doesn't seem to be related. The crash happens regardless of if the images property is in my config.
If I update the file while the development server isn't running and then start the server, the new config doesn't appear to be recognized until I save the config file again. At that point the server will crash after a second or two.
I've tried deleting node_modules and reinstalling on node 20.4.0, 18.17.0, and 16.17.0 and the error persists.
Error:
The trace file mentioned in the error is never actually created...
next.config.mjs:
If I update the file while the development server isn't running and then start the server, the new config doesn't appear to be recognized until I save the config file again. At that point the server will crash after a second or two.
I've tried deleting node_modules and reinstalling on node 20.4.0, 18.17.0, and 16.17.0 and the error persists.
Error:
node:events:490
throw er; // Unhandled 'error' event
^
Error: EPERM: operation not permitted, open '[path]\.next\trace'
Emitted 'error' event on WriteStream instance at:
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -4048,
code: 'EPERM',
syscall: 'open',
path: '[path]\\.next\\trace'
}
Node.js v20.4.0The trace file mentioned in the error is never actually created...
next.config.mjs:
/**
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation.
* This is especially useful for Docker builds.
*/
!process.env.SKIP_ENV_VALIDATION && (await import("./src/env.mjs"));
/** @type {import("next").NextConfig} */
const config = {
reactStrictMode: true,
images: {
remotePatterns: [
{
protocol: "https",
hostname: "images.gamebanana.com",
port: "443",
pathname: "/img/ss/mods/*.webp",
},
],
},
/**
* If you have the "experimental: { appDir: true }" setting enabled, then you
* must comment the below `i18n` config out.
*
* @see https://github.com/vercel/next.js/issues/41980
*/
i18n: {
locales: ["en"],
defaultLocale: "en",
},
};
export default config;3 Replies
Little EgretOP
Anyone? Or should I just submit a Github issue?
what is this import with await at the top of the file? 🤔 I would try removing it and checking if this issue still happens, I am not sure the top-level await is allowed on the config file
if it still happens you might want to create a minimal reproduction and create an issue in the repo, I haven't seen this error before