[BUG] `next export` to static HTML doesn't work
yonas opened this issue · comments
info - Linting and checking validity of types...
info - Creating an optimized production build...
info - Compiled successfully
info - Collecting page data...
info - Generating static pages (0/3)
TypeError: Cannot read properties of null (reading 'useEffect')
at exports.useEffect (/data/make-cd/files/usr/local/www/homepages/excalith/node_modules/react/cjs/react.production.min.js:24:292)
at App (/data/make-cd/files/usr/local/www/homepages/excalith/.next/server/pages/_app.js:52:53)
at Wc (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:68:44)
at Zc (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:253)
at Z (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
at $c (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
at bd (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:77:404)
at Z (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:217)
at Zc (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:71:479)
at Z (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
Error occurred prerendering page "/404". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: Cannot read properties of null (reading 'useEffect')
at exports.useEffect (/data/make-cd/files/usr/local/www/homepages/excalith/node_modules/react/cjs/react.production.min.js:24:292)
at App (/data/make-cd/files/usr/local/www/homepages/excalith/.next/server/pages/_app.js:52:53)
at Wc (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:68:44)
at Zc (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:253)
at Z (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
at $c (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
at bd (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:77:404)
at Z (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:217)
at Zc (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:71:479)
at Z (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
TypeError: Cannot read properties of null (reading 'useEffect')
at exports.useEffect (/data/make-cd/files/usr/local/www/homepages/excalith/node_modules/react/cjs/react.production.min.js:24:292)
at App (/data/make-cd/files/usr/local/www/homepages/excalith/.next/server/pages/_app.js:52:53)
at Wc (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:68:44)
at Zc (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:253)
at Z (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
at $c (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
at bd (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:77:404)
at Z (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:217)
at Zc (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:71:479)
at Z (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
Error occurred prerendering page "/500". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: Cannot read properties of null (reading 'useEffect')
at exports.useEffect (/data/make-cd/files/usr/local/www/homepages/excalith/node_modules/react/cjs/react.production.min.js:24:292)
at App (/data/make-cd/files/usr/local/www/homepages/excalith/.next/server/pages/_app.js:52:53)
at Wc (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:68:44)
at Zc (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:253)
at Z (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
at $c (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
at bd (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:77:404)
at Z (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:217)
at Zc (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:71:479)
at Z (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
TypeError: Cannot read properties of null (reading 'useEffect')
at exports.useEffect (/data/make-cd/files/usr/local/www/homepages/excalith/node_modules/react/cjs/react.production.min.js:24:292)
at App (/data/make-cd/files/usr/local/www/homepages/excalith/.next/server/pages/_app.js:52:53)
at Wc (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:68:44)
at Zc (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:253)
at Z (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
at $c (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
at bd (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:77:404)
at Z (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:217)
at Zc (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:71:479)
at Z (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: Cannot read properties of null (reading 'useEffect')
at exports.useEffect (/data/make-cd/files/usr/local/www/homepages/excalith/node_modules/react/cjs/react.production.min.js:24:292)
at App (/data/make-cd/files/usr/local/www/homepages/excalith/.next/server/pages/_app.js:52:53)
at Wc (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:68:44)
at Zc (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:253)
at Z (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
at $c (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
at bd (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:77:404)
at Z (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:217)
at Zc (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:71:479)
at Z (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
info - Generating static pages (3/3)
> Build error occurred
Error: Export encountered errors on following paths:
/
/_error: /404
/_error: /500
at /usr/local/lib/node_modules/next/dist/export/index.js:408:19
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Span.traceAsyncFn (/usr/local/lib/node_modules/next/dist/trace/trace.js:79:20)
at async /usr/local/lib/node_modules/next/dist/build/index.js:1331:21
at async Span.traceAsyncFn (/usr/local/lib/node_modules/next/dist/trace/trace.js:79:20)
at async /usr/local/lib/node_modules/next/dist/build/index.js:1191:17
at async Span.traceAsyncFn (/usr/local/lib/node_modules/next/dist/trace/trace.js:79:20)
at async Object.build [as default] (/usr/local/lib/node_modules/next/dist/build/index.js:65:29)
info - using build directory: /data/make-cd/files/usr/local/www/homepages/excalith/.next
info - Copying "static build" directory
info - No "exportPathMap" found in "/data/make-cd/files/usr/local/www/homepages/excalith/next.config.js". Generating map from "./pages"
info - Launching 15 workers
info - Exporting (0/3)
info - Copying "public" directory
TypeError: Cannot read properties of null (reading 'useEffect')
at exports.useEffect (/data/make-cd/files/usr/local/www/homepages/excalith/node_modules/react/cjs/react.production.min.js:24:292)
at App (/data/make-cd/files/usr/local/www/homepages/excalith/.next/server/pages/_app.js:52:53)
at Wc (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:68:44)
at Zc (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:253)
at Z (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
at $c (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
at bd (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:77:404)
at Z (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:217)
at Zc (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:71:479)
at Z (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
Error occurred prerendering page "/404.html". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: Cannot read properties of null (reading 'useEffect')
at exports.useEffect (/data/make-cd/files/usr/local/www/homepages/excalith/node_modules/react/cjs/react.production.min.js:24:292)
at App (/data/make-cd/files/usr/local/www/homepages/excalith/.next/server/pages/_app.js:52:53)
at Wc (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:68:44)
at Zc (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:253)
at Z (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
at $c (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
at bd (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:77:404)
at Z (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:217)
at Zc (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:71:479)
at Z (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
TypeError: Cannot read properties of null (reading 'useEffect')
at exports.useEffect (/data/make-cd/files/usr/local/www/homepages/excalith/node_modules/react/cjs/react.production.min.js:24:292)
at App (/data/make-cd/files/usr/local/www/homepages/excalith/.next/server/pages/_app.js:52:53)
at Wc (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:68:44)
at Zc (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:253)
at Z (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
at $c (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
at bd (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:77:404)
at Z (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:217)
at Zc (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:71:479)
at Z (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
Error occurred prerendering page "/404". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: Cannot read properties of null (reading 'useEffect')
at exports.useEffect (/data/make-cd/files/usr/local/www/homepages/excalith/node_modules/react/cjs/react.production.min.js:24:292)
at App (/data/make-cd/files/usr/local/www/homepages/excalith/.next/server/pages/_app.js:52:53)
at Wc (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:68:44)
at Zc (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:253)
at Z (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
at $c (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
at bd (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:77:404)
at Z (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:217)
at Zc (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:71:479)
at Z (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
TypeError: Cannot read properties of null (reading 'useEffect')
at exports.useEffect (/data/make-cd/files/usr/local/www/homepages/excalith/node_modules/react/cjs/react.production.min.js:24:292)
at App (/data/make-cd/files/usr/local/www/homepages/excalith/.next/server/pages/_app.js:52:53)
at Wc (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:68:44)
at Zc (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:253)
at Z (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
at $c (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
at bd (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:77:404)
at Z (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:217)
at Zc (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:71:479)
at Z (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: Cannot read properties of null (reading 'useEffect')
at exports.useEffect (/data/make-cd/files/usr/local/www/homepages/excalith/node_modules/react/cjs/react.production.min.js:24:292)
at App (/data/make-cd/files/usr/local/www/homepages/excalith/.next/server/pages/_app.js:52:53)
at Wc (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:68:44)
at Zc (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:253)
at Z (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
at $c (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
at bd (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:77:404)
at Z (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:217)
at Zc (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:71:479)
at Z (/usr/local/lib/node_modules/next/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
info - Exporting (3/3)
Error: Export encountered errors on following paths:
/
/_error: /404
/_error: /404.html
at /usr/local/lib/node_modules/next/dist/export/index.js:408:19
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Span.traceAsyncFn (/usr/local/lib/node_modules/next/dist/trace/trace.js:79:20)
OS: FreeBSD 13.1-RELEASE
Next.js v13.0.3
yarn 1.22.18
Hello @yonas, thanks for the report.
However, on my end commands below works as intended. Can you please uninstall node_modules
, .next
folders and yarn.lock
file and reinstall dependencies with yarn? Commands yarn build
and yarn next export
should be working.
Edit: I also pushed a new commit including export command. If you update your clone, you can simply use yarn export
Just in case, here are my versions for yarn and next
Next: v13.1.6
Yarn: 1.22.19
yarn next export
$ yarn next export
yarn run v1.22.19
$ /Users/excalith/Projects/Personal/start-page/node_modules/.bin/next export
info - using build directory: /Users/excalith/Projects/Personal/start-page/.next
info - Copying "static build" directory
info - No "exportPathMap" found in "/Users/excalith/Projects/Personal/start-page/next.config.js". Generating map from "./pages"
info - Launching 7 workers
info - Copying "public" directory
info - Exporting (3/3)
Export successful. Files written to /Users/excalith/Projects/Personal/start-page/out
✨ Done in 1.16s.
yarn build
$ yarn build
yarn run v1.22.19
$ next build
info - Linting and checking validity of types
info - Creating an optimized production build
info - Compiled successfully
info - Collecting page data
info - Generating static pages (3/3)
info - Finalizing page optimization
Route (pages) Size First Load JS
┌ ○ / 36 kB 111 kB
├ /_app 0 B 74.8 kB
└ ○ /404 181 B 75 kB
+ First Load JS shared by all 103 kB
├ chunks/framework-2c79e2a64abdb08b.js 45.2 kB
├ chunks/main-f11614d8aa7ee555.js 26.8 kB
├ chunks/pages/_app-51999c1545736967.js 1.92 kB
├ chunks/webpack-25ad1d8f464a5db7.js 805 B
└ css/c7809e139d3aa43d.css 28.2 kB
○ (Static) automatically rendered as static HTML (uses no initial props)
✨ Done in 6.46s.
@excalith Thanks, it woks!
Glad it did the trick, cheers!