NextJS 在构建时找不到模块constants.js

kak*_*akk 3 build build-error typescript next.js

next build使用nextversion运行时出现此错误^10.2.3。我尝试删除node_modules文件.next夹并重新运行,npm install && next build但没有成功。

  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'
  ]
Run Code Online (Sandbox Code Playgroud)

fun*_*err 10

尝试删除该.next文件夹并再次运行。