I encountered an error while executing next build
using next
version ^10.2.3
.
I attempted to remove the node_modules
and .next
folders, then reinstalled dependencies with
npm install && next build
, but the issue persists.
Error: Cannot find module 'next/dist/shared/lib/constants.js'
type: 'Error',
code: 'MODULE_NOT_FOUND',
requireStack: [
'.next/server/pages/_document.js',
'/usr/local/lib/node_modules/next/dist/server/require.js',
'/usr/local/lib/node_modules/next/dist/server/load-components.js',
'/usr/local/lib/node_modules/next/dist/build/utils.js',
'/usr/local/lib/node_modules/next/dist/build/worker.js',
'/usr/local/lib/node_modules/next/dist/compiled/jest-worker/processChild.js'
]