我在尝试部署我的nextjs应用程序时遇到此错误。我试过这些方法,但对我不起作用。
“Build & Development Settings”,覆盖Build命令并写入CI='' npm run build not works。
CI=假不起作用
[00:40:43.944] Cloning github.com/AnoshaJaved123/landing (Branch: main, Commit: ea731c3)
[00:40:44.258] Previous build cache not available
[00:40:44.831] Cloning completed: 887.407ms
[00:40:45.272] Running "vercel build"
[00:40:45.821] Vercel CLI 28.10.3
[00:40:46.180] Installing dependencies...
[00:40:52.830] npm WARN deprecated source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated
[00:41:02.288]
[00:41:02.288] added 549 packages in 16s
[00:41:02.289]
[00:41:02.289] 109 packages are looking for funding
[00:41:02.289] run `npm fund` for details
[00:41:02.310] Detected Next.js version: 13.0.4
[00:41:02.315] Detected `package-lock.json` generated by npm 7+...
[00:41:02.316] Running "npm run build"
[00:41:02.652]
[00:41:02.653] > web-builder@0.1.0 build
[00:41:02.653] > next build
[00:41:02.653]
[00:41:02.979] info - Loaded env from /vercel/path0/.env
[00:41:03.127] Attention: Next.js now collects completely anonymous telemetry regarding usage.
[00:41:03.128] This information is used to shape Next.js' roadmap and prioritize features.
[00:41:03.128] You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
[00:41:03.128] https://nextjs.org/telemetry
[00:41:03.128]
[00:41:03.260] info - Linting and checking validity of types...
[00:41:06.141] info - Creating an optimized production build...
[00:41:32.575] info - Compiled successfully
[00:41:32.575] info - Collecting page data...
[00:41:38.362]
[00:41:38.363] > Build optimization failed: found pages without a React Component as default export in
[00:41:38.363] pages/Editor/grapesUtils
[00:41:38.363] pages/templates/grapesUtils
[00:41:38.363]
[00:41:38.363] See https://nextjs.org/docs/messages/page-without-valid-component for more info.
[00:41:38.364]
[00:41:38.417] Error: Command "npm run build" exited with 1
1条答案
按热度按时间9rbhqvlz1#
我遇到了一个类似的错误,并发现了一个适合我的解决方案。要解决此问题,请在位于项目根目录的终端中运行命令“npm run build”。接下来,导航到设置菜单中的“构建和开发设置”部分,并更新设置,如随附的图像所示。通过执行这些步骤,您应该能够解决错误并继续执行项目,而不会出现进一步的问题。