我正在開發一個在本地作業的 Next.js 應用程式。但是當我部署我得到這個錯誤。
Vercel Deployment Error: Command "npm run build" exited with 1
這是我的建筑日志-
[08:26:17.892] Cloning github.com/Bossman556/TechMoneyLlc (Branch: main, Commit: 1fdf14b)
[08:26:17.899] The cli flag --force was set. Skipping build cache download.
[08:26:20.729] Cloning completed: 2.837s
[08:26:21.188] Not using Build Cache
[08:26:21.242] Running "vercel build"
[08:26:21.887] Vercel CLI 28.4.14
[08:26:22.295] Detected `package-lock.json` generated by npm 7 ...
[08:26:22.306] Installing dependencies...
[08:26:40.266] npm WARN deprecated core-js@3.6.5: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
[08:26:44.660]
[08:26:44.661] added 518 packages in 22s
[08:26:44.661]
[08:26:44.661] 95 packages are looking for funding
[08:26:44.661] run `npm fund` for details
[08:26:44.687] Detected Next.js version: 12.3.1
[08:26:44.694] Running "npm run build"
[08:26:45.093]
[08:26:45.094] > scam@0.1.0 build
[08:26:45.094] > next build
[08:26:45.094]
[08:26:45.684] Attention: Next.js now collects completely anonymous telemetry regarding usage.
[08:26:45.685] This information is used to shape Next.js' roadmap and prioritize features.
[08:26:45.685] 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:
[08:26:45.685] https://nextjs.org/telemetry
[08:26:45.685]
[08:26:45.831] info - Linting and checking validity of types...
[08:26:46.346] error - ESLint: Failed to load config "next/babel" to extend from. Referenced from: /vercel/path0/.eslintrc.json
[08:26:49.527] info - Creating an optimized production build...
[08:26:49.891] info - Disabled SWC as replacement for Babel because of custom Babel configuration ".babelrc" https://nextjs.org/docs/messages/swc-disabled
[08:26:50.658] info - Using external babel configuration from /vercel/path0/.babelrc
[08:27:08.485] info - Compiled successfully
[08:27:08.486] info - Collecting page data...
[08:27:12.880]
[08:27:12.880] > Build optimization failed: found page without a React Component as default export in
[08:27:12.880] pages/vidsForCourses/VideoPlayer
[08:27:12.881]
[08:27:12.881] See https://nextjs.org/docs/messages/page-without-valid-component for more info.
[08:27:12.881]
[08:27:12.942] Error: Command "npm run build" exited with 1
我嘗試過將環境變數 CI 設定為 false 的解決方案
CI = false
我也試過
In the "Build & Development Settings", override the Build command and write CI='' npm run build.
我也洗掉了節點版本,但這沒有用。
uj5u.com熱心網友回復:
在日志上,您有一個只能匯出但不能匯出默認值的組件。請洗掉 Pages 檔案夾內的組件,在 Pages 檔案夾外創建一個 Components 檔案夾,然后將您的組件移動到檔案夾內。
內頁/vidsForCourses/VideoPlayer
確保匯出默認值
const VideoPlayer = () => {
return <div>Your contents</div>
}
//your code might be
//export VideoPlayer;
//To fix, add "default" on your export
export default VideoPlayer;
uj5u.com熱心網友回復:
'在 pages/vidsForCourses/VideoPlayer 中找到沒有 React 組件的頁面作為默認匯出'
導致錯誤。我使用了這個解決方案
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/528982.html
上一篇:在物件陣列中過濾物件陣列
