gregrickaby / nextjs-github-pages Goto Github PK
View Code? Open in Web Editor NEWπ Deploy a Next.js app to GitHub Pages via GitHub Actions.
Home Page: https://gregrickaby.github.io/nextjs-github-pages/
License: MIT License
π Deploy a Next.js app to GitHub Pages via GitHub Actions.
Home Page: https://gregrickaby.github.io/nextjs-github-pages/
License: MIT License
Hi Greg, thanks so much for this!! As a nonprofit we cannot afford Vercel so this is our only option :)
Here is the error we're seeing when we run the script via github actions following https://gregrickaby.blog/article/nextjs-github-pages:
Run npm install
added 27 packages, and audited 28 packages in 4s
2 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
> build
> next build
warn - 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
info - Checking validity of types...
Failed to compile.
./components/CodeBlock.tsx:10:22
Type error: Cannot find name 'Prism'.
8 |
9 | React.useEffect(() => {
> 10 | if (ref.current) Prism.highlightElement(ref.current,false);
| ^
11 | }, [children]);
12 |
13 | return (
Error: Process completed with exit code 1.
Any ideas how to debug?
Here's the script: https://github.com/onefact/handbook.onefact.org/blob/main/.github/workflows/deploy.yml
Thanks again!!!
idk what could be the issue, i followed the instruction on the blog post
when i commit and the action starts it hangs on the "Deploy" task and does nothing, no logs or anything...
did i missed something?
Imagine having an articles
page which has a single article as well which is dynamic [slug].tsx
. During the build process, it throws this error:
Build error occurred
Error: Page "/articles/[slug]" is missing "generateStaticParams()" so it cannot be used with the "output: export" config.
How should we handle this situation. It is app router not page router to use generateStaticParams()
Great work on the tutorial!
When running the line you gave with the keygen, the terminal said there were too many commands. So, breaking it down, I was able to get the keygen done but -t rsa returns this error message:
"-t : The term '-t' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the
path is correct and try again.
At line:1 char:1
I don't fully understand all the steps happening here, so it's tough to try and debug or find a workaround. If you have Discord and want to chat about it, let me know!
Hey, @gregrickaby!
First of all, BIG thanks for your detailed instructions and the yml-file. I've been looking for a good starting boilerplate for deploying a Nextjs App via GitHub Pages and finally found it. You've helped me a lot.
Allow me to ask you a question.
I followed your manual in README.md but did not manage to make it. There was something wrong the path to images. Then I started experimenting. Eventually, the following changes worked for me:
next.config.mjs
:/** @type {import('next').NextConfig} */
const nextConfig = {
//...
basePath: "", // just empty string, but not the repo name
//...
};
export default nextConfig;
src
prop of Image
.See my working commit
I'm trying to understand how it works, but I cannot get why the method above works for my repo? Maybe they've changed something in the API. Please explain.
Thank you!
Is it possible to use github pages with app router introduced in next.js v13?
While deploying with github actions :
/usr/bin/git push origin gh-pages
warning: url contains a newline in its host component: https://x-access-token:***
Super helpful!! Thank you :)
Any idea how we might be able to get images working?
Iβve been trying to get the static import working (https://nextjs.org/docs/basic-features/image-optimization) on GitHub pages, and canβt figure out how to debug (for onefact.org and Payless.health)
Thank you again!
how would you go about deploying to username.github.io
rather than username.github.io/repo-name/
? edit the assetPrefix
value in nexts.config.js
?
The only problem I can see with Github pages, we can not use API in Github. we can call API in getStaticProps but all the nextjs API is 404.
https://gregrickaby.github.io/nextjs-github-pages/api/hello
Do you have any fix for this?
Error: Action failed with "not found deploy key or tokens"
Instead of Adding BasePath like this
src="/nextjs-github-pages/vercel.svg"
We can prepend the src with . and it works on Both Local and Prod
src="./profile/passport.avif"
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?
output: "export" is deprecated. It doesn't work anymore.
Hi!
I find it difficult to create pages with this template. The app is not following the create-next-app template and I cannot create next pages as I used to under the pages folder.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.