I try to run a Next.js Docker container with the commands:
docker build -t nextjs-docker .docker run -p 3000:3000 nextjs-docker
But if I try to run the container, the following error pops up:
⚠ Invalid next.config.js options detected:⚠ Unrecognized key(s) in object: 'jsconfigPaths' at "experimental"⚠ See more info here: https://nextjs.org/docs/messages/invalid-next-configError: ENOENT: no such file or directory, open '/internetsuite_FE/.next/BUILD_ID' at async open (node:internal/fs/promises:641:25) at async Object.readFile (node:internal/fs/promises:1254:14) at async setupFsCheck (/internetsuite_FE/node_modules/next/dist/server/lib/router-utils/filesystem.js:142:19) at async initialize (/internetsuite_FE/node_modules/next/dist/server/lib/router-server.js:56:23) at async Server.<anonymous> (/internetsuite_FE/node_modules/next/dist/server/lib/start-server.js:221:36) { errno: -2, code: 'ENOENT', syscall: 'open', path: '/internetsuite_FE/.next/BUILD_ID'}
So I looked in the file next.config.js
:
const path = require('path')module.exports = { trailingSlash: true, reactStrictMode: false, experimental: { esmExternals: false, jsconfigPaths: true // enables it for both jsconfig.json and tsconfig.json }, webpack: config => { config.resolve.alias = { ...config.resolve.alias, apexcharts: path.resolve(__dirname, './node_modules/apexcharts-clevision') } return config }}
But I don't see any strange thing about the experimental property.
This is the Dockerfile:
FROM node:alpineWORKDIR /internetsuite_FECOPY package.json .RUN npm iCOPY . .CMD ["npm", "start"]
How to resolve the error?
Unrecognized key(s) in object: 'jsconfigPaths' at "experimental"