next.js 面对引用错误:在vercel中部署时,未定义self

hgncfbus  于 2023-10-18  发布在  其他
关注(0)|答案(1)|浏览(111)
ReferenceError: self is not defined
    at Object.<anonymous> (/vercel/path0/.next/server/pages/middleware.js:1:1)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Object.requirePage (/vercel/path0/node_modules/next/dist/server/require.js:88:12)
    at /vercel/path0/node_modules/next/dist/server/load-components.js:48:73
    at async Object.loadComponents (/vercel/path0/node_modules/next/dist/server/load-components.js:48:26)
> Build error occurred
Error: Failed to collect page data for /middleware
    at /vercel/path0/node_modules/next/dist/build/utils.js:963:15 {
  type: 'Error'
}
Error: Command "npm run build" exited with 1

当在vercel中部署时,我得到了这个错误“Self is not defined”。它在npm run dev时工作正常,但在部署时得到了一个错误

omqzjyyz

omqzjyyz1#

只是你需要移动你的组件,你有这个错误外页文件夹

相关问题