Is there any way to make a Node.js site static?

I’m sorry if this is a stupid question but I have made a blunder and need some help.

I hired a web developer to build a simple one-page website.

I repeatedly said the website must be fully static with no server-side processing.

The developer ended up using Node.js and I didn’t find out until I was trying to deploy on GitHub Pages.

I’ve already paid the developer, so now I don’t know what to do with the code I have.

Is there anything I can do to make the website deployable on GitHub pages?

The very first thing you should do, before jumping to too many conclusions, is to reach out to the dev and ask them about what they delivered. If they delivered a dynamic web app, that’s a big mistake on their part, but “using node.js” could mean many things. They could have given you a static site generator project, or they could have provided static files and included a simple standalone server to make it easy to view locally. Finding out what you actually have will be a necessary first step in moving forward.

I mean you’d have to ask the developer. Plenty of people use npm to, for example, install vitepress https://vitepress.dev/. So you’d have to install node packages to change things but the output is still static.

Yes. It just needs to be built and hosted. If you need help just ask.

The build output doesn’t care so long as it is all bundled. Node.js won’t cause you issues; you’re using it oftentimes just for the dev tooling.

@Laine
I saw a stack overflow post that explicitly said you can’t use Node.js on GitHub pages so that’s why I concluded. Is there anything I can read to help me figure out what to do?

Lennon said:
@Laine
I saw a stack overflow post that explicitly said you can’t use Node.js on GitHub pages so that’s why I concluded. Is there anything I can read to help me figure out what to do?

Stack overflow often has half-truths.

Static pages can be and often are built using node.js. npm start will run the development server, and npm build will create the static website in a subdirectory dist/. This is how a lot of the projects work.

If you don’t know how to deploy what they have created to GitHub pages, then ask.

@Wynter
What is the half-truth there?

It’s 100% true that you can’t use Node.js on GitHub pages; the fact that there’s a build step doesn’t change that fact or make it a half-truth.

Marlow said:
@Wynter
What is the half-truth there?

It’s 100% true that you can’t use Node.js on GitHub pages; the fact that there’s a build step doesn’t change that fact or make it a half-truth.

The half-truth is that you can host a node.js generated page on GitHub pages, but you can’t host node.js on GitHub pages. This is a difference that might be clear to a lot of developers, but for OP, these both seem to be the same.

Lennon said:
@Laine
I saw a stack overflow post that explicitly said you can’t use Node.js on GitHub pages so that’s why I concluded. Is there anything I can read to help me figure out what to do?

You can’t use any backend on GH pages, but it is fairly likely the project is only using Node to build the static site, and GH can use Node for that step.

Lennon said:
@Laine
I saw a stack overflow post that explicitly said you can’t use Node.js on GitHub pages so that’s why I concluded. Is there anything I can read to help me figure out what to do?

You gotta tell us more about the project. In what way does it use node? What happens when you open index.html?

Lennon said:
@Laine
I saw a stack overflow post that explicitly said you can’t use Node.js on GitHub pages so that’s why I concluded. Is there anything I can read to help me figure out what to do?

You may want to try using the free tier of Netlify for hosting. You’ll be able to connect your GitHub account and deploy from a branch (main if needs be). They will build and deploy for you. I’m happy to help you set this up, although it is super straightforward.

@Whit
If there is not another option then that’s what I will do, but I wanted to stay on GitHub pages.

Lennon said:
@Whit
If there is not another option then that’s what I will do, but I wanted to stay on GitHub pages.

What’s the attraction to GitHub Pages out of curiosity?

Zuri said:

Lennon said:
@Whit
If there is not another option then that’s what I will do, but I wanted to stay on GitHub pages.

What’s the attraction to GitHub Pages out of curiosity?

Cost

Lennon said:
@Whit
If there is not another option then that’s what I will do, but I wanted to stay on GitHub pages.

As you like. It’s easy to set up and cost-effective.

Lennon said:
@Laine
I saw a stack overflow post that explicitly said you can’t use Node.js on GitHub pages so that’s why I concluded. Is there anything I can read to help me figure out what to do?

If you don’t know code well enough to look into the source yourself, then you will need to get help. Try looking in the package.json, run the build; it will dump out some folder with built assets. If you know how to run a webserver, then run it in that directory and test. Otherwise, simply open the index.html file and see if it works. If it does, then you don’t care about Node.js or not; it is a built static site.

Quick way would be to save the pages from the browser as they are fully rendered, then upload those files to GH pages. You may need to edit the links and asset URLs if they are absolute paths.

Bao said:
Quick way would be to save the pages from the browser as they are fully rendered, then upload those files to GH pages. You may need to edit the links and asset URLs if they are absolute paths.

This, and don’t do it manually. 20 years ago, when the internet was awfully slow and the sites were awfully bloated, there was a Teleport Pro app which did exactly what you want - crawled an entire site and saved it as a set of static pages so you could interact with it offline.

I doubt this app is still around, but sure some modern analogue is.

@Frost
You can do it with wget --mirror --convert-links --adjust-extension --page-requisites --no-parent <URL>

Bao said:
Quick way would be to save the pages from the browser as they are fully rendered, then upload those files to GH pages. You may need to edit the links and asset URLs if they are absolute paths.

Sure! You can connect GitHub repo to those hosts!