I’m building a new portfolio site with react, and I want to host it on Netlify. My localhost build works fine with no errors, but when I deploy it to my live domain it’s just a blank screen. The favicon and title updated, but the react app itself doesn’t seem to be running. Here is the repo. And here is the live site. Any help would be appreciated.
It appears from a first look that you are using the correct publish directory, but your build isn’t running.
I can’t see what you’ve setup in your netlify app settings, but you may want to either set your base directory to
portfolio or move your code into the root directory or run the same commands you do locally to get the build correctly.
I’m suspecting your build command might be failing. Can you post the link to the build/deploy logs of the last deploy?
Try changing your “Build command:” to
npm run build instead.
Also, you need to change your “Publish directory:” to
portfolio/build because that is where the build files will get created. The
public folder is just a static folder for the build to use to copy the files for the build.
Ok, another thing that’s going to mess you up is the
"homepage": "portfolio/public", setting in your
package.json file. Since you are not publishing to this path, you need to delete that line. Create react app uses that setting to set the absolute path of your assets and they are not in that location on deploy.
Sorry for all the edits, but the above are the issues I see so far with your project.
Not a problem. Your solution fixed my problem. Thanks for the help!