Open up the source code for this app, and in the package.json file, add this key-value pair. This is because your site is no longer deployed at the root but instead deployed one level deeper at So, how do we resolve this issue? Let’s take a look. github.io then you may not get the above error after enabling GitHub Pages. You may get this error only if you’re using GitHub Pages with your project site, i.e., of the format If your repository is named using the format. Obviously, since no JavaScript or CSS files exists in the base URL, we’re getting a 404 error. Note the URL it’s trying to get the JavaScript and CSS files from - it’s using the base URL but not using the path create-react-app-ghpages-demo. Since this will be the first time you’re visiting the site, it might have not updated things in the background just yet. Tip: If you don’t see an empty screen and instead, see a 404 message from GitHub, please wait for a couple of minutes, try a different browser and finally, try clearing the cache. You may see an empty screen and if you open up the console, you’ll see a bunch of errors. I just made sure it works locally by running the command npm run start and that’s about it. I haven’t added or modified anything - these are the files and folders that get generated out-of-the-box when we run the npx command stated above. npx create-react-app -template typescriptĪt this point, your project directory should look something like the screenshot below. I’ve used the following command to generate this sample React app. We’ll begin by creating a React app using the Create React App utility and also add the code to a GitHub repository. This article aims at recreating the scenario and walking you through the process of solving each problem we encounter along the way. After some trial and error, I managed to sort it out. I thought it would be pretty straightforward to deploy this site using GitHub Pages, however, I was wrong. I recently created a website using the Create React App starter template to demonstrate an npm package I developed. Featured logo’s left to right: React, GitHub and GitHub Actions.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |