timlrx / tailwind-nextjs-starter-blog

This is a Next.js, Tailwind CSS blogging starter template. Comes out of the box configured with the latest technologies to make technical writing a breeze. Easily configurable and customizable. Perfect as a replacement to existing Jekyll and Hugo individual blogs.
https://tailwind-nextjs-starter-blog.vercel.app/
MIT License
8.56k stars 1.98k forks source link

GitHub Action build Process completed with exit code 1. #774

Closed stepcellwolf closed 10 months ago

stepcellwolf commented 10 months ago

Describe the bug

When I run npm run build in local machine it is working, however when I tried with GitHub page/actions workflow it is not working. Please see the following error: `Run yarn next build ⚠ No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache Attention: Next.js now collects completely anonymous telemetry regarding usage. This information is used to shape Next.js' roadmap and prioritize features. 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: https://nextjs.org/telemetry

Creating an optimized production build ... Failed to compile.

./app/about/page.tsx Module not found: Package path ./generated is not exported from package /home/runner/work/pt-nextjs-blog/pt-nextjs-blog/node_modules/contentlayer (see exports field in /home/runner/work/pt-nextjs-blog/pt-nextjs-blog/node_modules/contentlayer/package.json)

https://nextjs.org/docs/messages/module-not-found

./app/blog/[...slug]/page.tsx Module not found: Package path ./generated is not exported from package /home/runner/work/pt-nextjs-blog/pt-nextjs-blog/node_modules/contentlayer (see exports field in /home/runner/work/pt-nextjs-blog/pt-nextjs-blog/node_modules/contentlayer/package.json)

https://nextjs.org/docs/messages/module-not-found

./app/blog/page.tsx Module not found: Package path ./generated is not exported from package /home/runner/work/pt-nextjs-blog/pt-nextjs-blog/node_modules/contentlayer (see exports field in /home/runner/work/pt-nextjs-blog/pt-nextjs-blog/node_modules/contentlayer/package.json)

https://nextjs.org/docs/messages/module-not-found

./app/blog/page/[page]/page.tsx Module not found: Package path ./generated is not exported from package /home/runner/work/pt-nextjs-blog/pt-nextjs-blog/node_modules/contentlayer (see exports field in /home/runner/work/pt-nextjs-blog/pt-nextjs-blog/node_modules/contentlayer/package.json)

https://nextjs.org/docs/messages/module-not-found

./app/page.tsx Module not found: Package path ./generated is not exported from package /home/runner/work/pt-nextjs-blog/pt-nextjs-blog/node_modules/contentlayer (see exports field in /home/runner/work/pt-nextjs-blog/pt-nextjs-blog/node_modules/contentlayer/package.json)

https://nextjs.org/docs/messages/module-not-found

Build failed because of webpack errors Error: Process completed with exit code 1. `

Summary Annotations 1 error 1 and warning Build error: Process completed with exit code 1.

Build warning: Unsupported configuration file extension. Currently supported extensions: ".js", ".cjs", ".mjs"

To Reproduce Here is the Github workflow.

Expected behavior Tried with cleaning the cache, remove and install from beginning the npm modules, and packages. And node versino is same as in GitHub Action

System Info (if dev / build issue):

Additional context Full repository available at Link

timlrx commented 10 months ago

Try using node 18+. It seems like it's not able to read the ./generated created by contentlayer.

stepcellwolf commented 10 months ago

Hi, same error, with the following Environment details:

Run yarn next build yarn next build shell: /usr/bin/bash -e {0} env: GITHUB_PAGES: true ⚠ No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache Attention: Next.js now collects completely anonymous telemetry regarding usage. This information is used to shape Next.js' roadmap and prioritize features. 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: https://nextjs.org/telemetry

Creating an optimized production build ... Failed to compile.

./app/about/page.tsx Module not found: Package path ./generated is not exported from package /home/runner/work/pt-nextjs-blog/pt-nextjs-blog/node_modules/contentlayer (see exports field in /home/runner/work/pt-nextjs-blog/pt-nextjs-blog/node_modules/contentlayer/package.json)

https://nextjs.org/docs/messages/module-not-found

./app/blog/[...slug]/page.tsx Module not found: Package path ./generated is not exported from package /home/runner/work/pt-nextjs-blog/pt-nextjs-blog/node_modules/contentlayer (see exports field in /home/runner/work/pt-nextjs-blog/pt-nextjs-blog/node_modules/contentlayer/package.json)

https://nextjs.org/docs/messages/module-not-found

./app/blog/page.tsx Module not found: Package path ./generated is not exported from package /home/runner/work/pt-nextjs-blog/pt-nextjs-blog/node_modules/contentlayer (see exports field in /home/runner/work/pt-nextjs-blog/pt-nextjs-blog/node_modules/contentlayer/package.json)

https://nextjs.org/docs/messages/module-not-found

./app/blog/page/[page]/page.tsx Module not found: Package path ./generated is not exported from package /home/runner/work/pt-nextjs-blog/pt-nextjs-blog/node_modules/contentlayer (see exports field in /home/runner/work/pt-nextjs-blog/pt-nextjs-blog/node_modules/contentlayer/package.json)

https://nextjs.org/docs/messages/module-not-found

./app/page.tsx Module not found: Package path ./generated is not exported from package /home/runner/work/pt-nextjs-blog/pt-nextjs-blog/node_modules/contentlayer (see exports field in /home/runner/work/pt-nextjs-blog/pt-nextjs-blog/node_modules/contentlayer/package.json)

https://nextjs.org/docs/messages/module-not-found

Build failed because of webpack errors Error: Process completed with exit code 1.

stepcellwolf commented 10 months ago

Hi @timlrx any updates on this one. It seems is not working with node 18+ either.

timlrx commented 10 months ago

Sorry about this, I don't really have time currently to investigate why the github runner is not picking up the .contentlayer/generated folder or if it is correctly generating.

Could you try triggering contentlayer manually in the github build process: npx contentlayer build. if it is not able to find this then I am out of ideas and maybe you could try checking with the contentlayer github to see if anyone has tried integrating it with github action.

stepcellwolf commented 10 months ago

Thanks, no worries. I already tried with npx contentlayer build still same issue. Let me try with other images, and I already reached out to the contentlayer github community.

timlrx commented 10 months ago

Here's a successful deployment: https://github.com/timlrx/tailwind-nextjs-starter-blog/tree/test-gh-pages-static. I just used yarn as the package manager and did not encounter any issues, other than github pages specific changes which I had to fix.

stepcellwolf commented 10 months ago

HI Thanks a lot. I also managed to deploy it by myself last night. Here is the workflow code: https://github.com/stepcellwolf/pt-nextjs-blog/blob/main/.github/workflows/nextjs.yml. With the contentlayer version 0.3.4 Thanks a lot.