next.js 在Vercel上部署但在本地工作时出现错误500

ccrfmcuu  于 2023-10-18  发布在  其他
关注(0)|答案(1)|浏览(167)

我一直得到错误500| vercel上的内部服务器错误,但我的项目在localhost中完美工作。我还没有改变任何东西,似乎有关的错误,甚至当我试图回到以前的版本,工作,我一直得到的问题
我在Vercel日志中发现了这个错误:

'/var/task/node_modules/next/dist/server/require.js',
    '/var/task/node_modules/next/dist/server/next-server.js',
    '/var/task/___next_launcher.cjs'
  ],
  page: '/'
}
Error: Cannot find module 'core-js/modules/es.array.map.js'
Require stack:
- /var/task/node_modules/next-i18next/dist/commonjs/config/createConfig.js
- /var/task/node_modules/next-i18next/dist/commonjs/appWithTranslation.js
- /var/task/node_modules/next-i18next/dist/commonjs/index.js
- /var/task/.next/server/pages/_app.js
- /var/task/node_modules/next/dist/server/require.js
- /var/task/node_modules/next/dist/server/next-server.js
- /var/task/___next_launcher.cjs
    at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
    at /var/task/node_modules/next/dist/server/require-hook.js:54:36
    at Module._load (node:internal/modules/cjs/loader:922:27)
    at Ze.e.<computed>._module.Module._load (/var/task/___vc/__launcher/__launcher.js:14:1964)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at mod.require (/var/task/node_modules/next/dist/server/require-hook.js:64:28)
    at require (node:internal/modules/cjs/helpers:121:18)
    at Object.<anonymous> (/var/task/node_modules/next-i18next/dist/commonjs/config/createConfig.js:35:1)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/var/task/node_modules/next-i18next/dist/commonjs/config/createConfig.js',
    '/var/task/node_modules/next-i18next/dist/commonjs/appWithTranslation.js',
    '/var/task/node_modules/next-i18next/dist/commonjs/index.js',
    '/var/task/.next/server/pages/_app.js',
    '/var/task/node_modules/next/dist/server/require.js',
    '/var/task/node_modules/next/dist/server/next-server.js',
    '/var/task/___next_launcher.cjs'
  ]
}
Error: Cannot find module 'core-js/modules/es.array.map.js'
Require stack:
- /var/task/node_modules/next-i18next/dist/commonjs/config/createConfig.js
- /var/task/node_modules/next-i18next/dist/commonjs/appWithTranslation.js
- /var/task/node_modules/next-i18next/dist/commonjs/index.js
- /var/task/.next/server/pages/_app.js
- /var/task/node_modules/next/dist/server/require.js
- /var/task/node_modules/next/dist/server/next-server.js
- /var/task/___next_launcher.cjs
    at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
    at /var/task/node_modules/next/dist/server/require-hook.js:54:36
    at Module._load (node:internal/modules/cjs/loader:922:27)
    at Ze.e.<computed>._module.Module._load (/var/task/___vc/__launcher/__launcher.js:14:1964)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at mod.require (/var/task/node_modules/next/dist/server/require-hook.js:64:28)
    at require (node:internal/modules/cjs/helpers:121:18)
    at Object.<anonymous> (/var/task/node_modules/next-i18next/dist/commonjs/config/createConfig.js:35:1)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/var/task/node_modules/next-i18next/dist/commonjs/config/createConfig.js',
    '/var/task/node_modules/next-i18next/dist/commonjs/appWithTranslation.js',
    '/var/task/node_modules/next-i18next/dist/commonjs/index.js',
    '/var/task/.next/server/pages/_app.js',
    '/var/task/node_modules/next/dist/server/require.js',
    '/var/task/node_modules/next/dist/server/next-server.js',
    '/var/task/___next_launcher.cjs'
  ],
  page: '/'
}
Error: Runtime exited without providing a reason
Runtime.ExitError```
pexxcrt2

pexxcrt21#

目前next v13.5.4和next-i18next之间存在问题。
确保Next.js是v13.5.3(包括在package-lock.json中)。
我也遇到了同样的问题,并通过在package.json中将其固定在v13.5.3旁边来解决它(比如从"next": "^13.5.3""next": "13.5.3",没有插入符号)。
在我的例子中,我之前确实运行了npm audit fix,用下一个v13.5.4更新了我的package-lock.json,这导致了问题。
这似乎是避免这个问题的方法,直到nextnext-i18next有一个修复它。

相关问题