gregrickaby / nextjs-github-pages

🚀 Deploy a Next.js app to GitHub Pages via GitHub Actions.
https://gregrickaby.github.io/nextjs-github-pages/
MIT License
448 stars 61 forks source link

No `/out` folder is created when usign Github Actions #57

Closed xtanion closed 7 months ago

xtanion commented 9 months ago

I tried printing the files/folders after the next build in github actions. I get the following result:


Run ls -a
.
..
.eslintrc.json
.git
.github
.gitignore
.next
README.md
next-env.d.ts
next.config.js
next.config.mjs
node_modules
package-lock.json
package.json
postcss.config.js
public
src
tailwind.config.ts
tsconfig.json```
There is no `/out` folder created, However, when running on my local machine, it works just fine. Can anyone please help me with this?
piantino commented 8 months ago

@xtanion I solved this problem removing this part:

- name: Setup Pages
        uses: actions/configure-pages@v4
        with:
          # Automatically inject basePath in your Next.js configuration file and disable
          # server side image optimization (https://nextjs.org/docs/api-reference/next/image#unoptimized).
          #
          # You may remove this line if you want to manage the configuration yourself.
          static_site_generator: next

This was injecting wrong parameters for this version of Nextjs:

 âš  Invalid next.config.js options detected: 
 âš      Unrecognized key(s) in object: 'images' at "experimental"

But the next.config.mjs must have: output, images and basePath parameters:

/** @type {import('next').NextConfig} */
const nextConfig = {
    output: 'export',
    images: {
        unoptimized: true
    },
    basePath: "/"
};

export default nextConfig;
guillett commented 8 months ago

Thanks a lot, it is sooooo annoying to have to deal with unsolicited advise from GH with relatively complex workflow with flaws. A bug like a needle in a haystack.

Many thanks!