npmnext.jsmjs

Unrecognized key(s) in object: 'appDir' at "experimental" - Next.js 14.0.4 error


I updated the next.js and appeared an error. I searched that error and I didn't found the solution, even the official website of the next.js.

The error is here:

> sbm@0.0.1 dev
> next dev

   ▲ Next.js 14.0.4
   - Local:        http://localhost:3000
   - Environments: .env.local

 ⚠     Invalid next.config.mjs options detected:
 ⚠     Unrecognized key(s) in object: 'appDir' at "experimental"
 ⚠     See more info here: https://nextjs.org/docs/messages/invalid-next-config    
   
[Error: EINVAL: invalid argument, readlink 
'C:\Users\felip\Documentos\developer\bio\.next\server\server-reference-manifest.json'] {
  errno: -4071,
  code: 'EINVAL',
  syscall: 'readlink',
  path: 'C:\\Users\\felip\\Documentos\\developer\\bio\\.next\\server\\server-reference-manifest.json'
}

I tried to fix it, doing what says on next.js website, but it didn't work. Look what appeared:

> sbm@0.0.1 dev
> next dev

   ▲ Next.js 14.0.4
   - Local:        http://localhost:3000
   - Environments: .env.local

[Error: EINVAL: invalid argument, readlink 
'C:\Users\felip\Documentos\developer\bio\.next\server\server-reference-manifest.json'] {
  errno: -4071,
  code: 'EINVAL',
  syscall: 'readlink',
  path: 'C:\\Users\\felip\\Documentos\\developer\\bio\\.next\\server\\server-reference-manifest.json'
}

Solution

  • Remove the appDir prop from the experimental obj in next.config.mjs.

    experimental: {
      appDir: true,
    },
    

    This option is no longer needed as of Next.js 13.4.