vercel deploy next.js error All In One

vercel deploy next.js error All In One

image

https://vercel.com/web-full-stack/nextjs-ssr/deployments

https://nextjs-ssr.xgqfrms.xyz/

bug

[23:57:30.114] Cloning github.com/web-full-stack/nextjs-ssr (Branch: main, Commit: 4124ea8)
[23:57:30.830] Cloning completed: 715.86ms
[23:57:32.482] Restored build cache
[23:57:32.519] Running "vercel build"
[23:57:33.018] Vercel CLI 28.6.0
[23:57:33.347] Installing dependencies...
[23:57:34.992] 
[23:57:34.992] changed 1 package in 1s
[23:57:35.004] Detected Next.js version: 13.0.3
[23:57:35.007] Detected `package-lock.json` generated by npm 7+...
[23:57:35.007] Running "npm run build"
[23:57:35.297] 
[23:57:35.297] > [email protected] build
[23:57:35.297] > next build
[23:57:35.297] 
[23:57:35.813] info  - Linting and checking validity of types...
[23:57:37.552] info  - Creating an optimized production build...
[23:57:40.287] info  - Compiled successfully
[23:57:40.288] info  - Collecting page data...
[23:57:40.574] ✅ __dirname = /vercel/posts
[23:57:40.575] ❌ process.cwd() = /vercel/path0
[23:57:40.575] ❌ postsDirectory = /vercel/path0/posts
[23:57:40.588] ✅ __dirname = /vercel/posts
[23:57:40.588] ❌ process.cwd() = /vercel/path0
[23:57:40.589] ❌ postsDirectory = /vercel/path0/posts
[23:57:40.591] 🚧 filename = 2021/01/01/first
[23:57:40.592] 🚧 filename = 2022/11/01/first
[23:57:40.592] 🚧 filename = 2022/11/30/last
[23:57:40.592] 🚧 filename = 2022/12/01/first
[23:57:40.592] 🚧 filename = 2022/12/31/last
[23:57:40.595] ids = [
[23:57:40.595]   {
[23:57:40.595]     id: '/vercel/path0/posts/2021/01/01/first.md',
[23:57:40.595]     year: '2021',
[23:57:40.595]     month: '01',
[23:57:40.595]     day: '01',
[23:57:40.596]     title: 'first'
[23:57:40.596]   },
[23:57:40.596]   {
[23:57:40.596]     id: '/vercel/path0/posts/2022/11/01/first.md',
[23:57:40.596]     year: '2022',
[23:57:40.597]     month: '11',
[23:57:40.597]     day: '01',
[23:57:40.597]     title: 'first'
[23:57:40.597]   },
[23:57:40.597]   {
[23:57:40.597]     id: '/vercel/path0/posts/2022/11/30/last.md',
[23:57:40.597]     year: '2022',
[23:57:40.597]     month: '11',
[23:57:40.598]     day: '30',
[23:57:40.598]     title: 'last'
[23:57:40.598]   },
[23:57:40.598]   {
[23:57:40.598]     id: '/vercel/path0/posts/2022/12/01/first.md',
[23:57:40.598]     year: '2022',
[23:57:40.598]     month: '12',
[23:57:40.598]     day: '01',
[23:57:40.598]     title: 'first'
[23:57:40.599]   },
[23:57:40.599]   {
[23:57:40.599]     id: '/vercel/path0/posts/2022/12/31/last.md',
[23:57:40.599]     year: '2022',
[23:57:40.599]     month: '12',
[23:57:40.599]     day: '31',
[23:57:40.599]     title: 'last'
[23:57:40.599]   }
[23:57:40.600] ]
[23:57:40.600] Error: A required parameter (date-string) was not provided as a string in getStaticPaths for /posts/[date-string]/[title]
[23:57:40.600]     at /vercel/path0/node_modules/next/dist/build/utils.js:656:27
[23:57:40.600]     at Array.forEach (<anonymous>)
[23:57:40.601]     at /vercel/path0/node_modules/next/dist/build/utils.js:649:29
[23:57:40.601]     at Array.forEach (<anonymous>)
[23:57:40.601]     at buildStaticPaths (/vercel/path0/node_modules/next/dist/build/utils.js:620:17)
[23:57:40.601]     at async /vercel/path0/node_modules/next/dist/build/utils.js:929:115
[23:57:40.601]     at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:79:20)
[23:57:40.601] 
[23:57:40.601] > Build error occurred
[23:57:40.602] Error: Failed to collect page data for /posts/[date-string]/[title]
[23:57:40.602]     at /vercel/path0/node_modules/next/dist/build/utils.js:959:15 {
[23:57:40.603]   type: 'Error'
[23:57:40.603] }
[23:57:40.634] Error: Command "npm run build" exited with 1

https://vercel.com/web-full-stack/nextjs-ssr/GMZPJs1r5cNd7pYSQMEzKZr22W7D

deployments environment

https://github.com/web-full-stack/nextjs-ssr/deployments

https://github.com/web-full-stack/nextjs-ssr/deployments/activity_log?environment=Production

https://github.com/web-full-stack/nextjs-ssr/deployments/activity_log?environment=Preview

solution ✅

const fsp = require('fs').promises;
// fsp.readdir

const fs = require('fs');
// fs.readFileSync

image

https://github.com/web-full-stack/nextjs-ssr/commit/3f6c8ec13cf9c3b51ebd5a47cbe119024cfa8d9d

(🐞 反爬蟲測試!打擊盜版⚠️)如果你看到這個信息, 說明這是一篇剽竊的文章,請訪問 https://www.cnblogs.com/xgqfrms/ 查看原創文章!

refs



©xgqfrms 2012-2021

www.cnblogs.com/xgqfrms 發佈文章使用:只允許註冊用戶纔可以訪問!

原創文章,版權所有©️xgqfrms, 禁止轉載 🈲️,侵權必究⚠️!


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章