How to fix errors at deploying React apps with AWS Amplify

Seito Horiguchi
1 min readJul 18, 2021

Hi,

I met a few errors when I tried to deploy a SPA with React and AWS Amplify the other day.

Let me introduce in this article how I fixed them.

It may help you if you now have the following errors.

  1. “ERR_ABORTED 403" in manifest.json
  2. “Uncaught SyntaxError: Unexpected token ‘<’“ in index.html

In these cases, you can try the following solutions.

Check “package.json”

If ”package.json” has the code for deploying to “gh-pages” in GitHub, it’s better to remove it like this. it may disturb your deploy in AWS

“homepage”: “https://user-developer.github.io/project_name"

Try “amplify publish” again and verify paths

You may be better to try the commands “amplify publish” and “ yarn build”. The errors sometimes are caused by mistaking paths. you can confirm paths of href and src in index.html

This is a sample and you can find paths in it.

<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>React App</title><link href="/static/css/main.feda3d3d.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script> ...... </script><script src="/static/js/2.3c825274.chunk.js"></script><script src="/static/js/main.69363c5f.chunk.js"></script></body></html>

Build command for yarn

yarn build

Deploy command for amplify

amplify publish

--

--