Having difficulty deploying project to Github Pages

I feel as if I’ve finished the Metric Imperial Converter so I’ve been trying to deploy it to GitHub pages so that I can submit it and get feedback before moving on to the next project.

I’ve tried following two different videos (video #1, video #2) to deploy my project to GitHub pages.

Unfortunately, in both cases I get the following error:

sh: react-scripts: command not found
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! fcc-imperial-metric-converter-boilerplate@1.0.0 build: `react-scripts build`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the fcc-imperial-metric-converter-boilerplate@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

I’ve tried to npm install react-scripts or just copy and paste text into my package.json like so:

  "scripts": {
    "start": "node server.js",
    "test": "mocha ./tests/ --ui tdd",
    "predeploy": "npm run build",
    "deploy": "gh-pages -d build",
    "build": "react-scripts build"

Regardless of what I try, however, I can’t seem to make any progress. Can anyone help? My repo is here, and the live site I can’t properly deploy to is here.

I greatly appreciate any suggestions you may have.

In your repo, you do not have react-scripts as an installed dependencies. To install it, you can run npm install react-scripts --save

Just to clarify: GitHub Pages cannot host fullstack applications - it can only host the frontend. So, you need to host the backend somewhere else.

Hi @camchardukian !

You could look into heroku for deploying your project instead.
That is a pretty popular choice.

Hi, it looks like github pages is deployed for the project already, but it’s using Readme.md as the entry point. Looking through the repo, it looks like the entry point for your app may be views/index.html? If you put a file named index.html in the root directory of your repo, Github pages will automatically use that as the entry point. But if there is no root-level index.html it will use Readme.md as a fallback I believe.

But given that your app includes a server.js express app, you’ll need to either use a different service than GH pages or refactor your app to handle all functionality in client-side javascript (because GH pages only serves static sites).

A popular free choice for working with freecodecamp is repl.it, which can host node projects online.

Other alternatives are:

1 Like

Thank you everyone for both helping me understand not only what I did wrong but also offering alternatives. Bless all of you! :heart_eyes:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.