1

When I run npm start it throws this error:

Proxy inside package.json must be a string react issue

Here is how it looks inside package.json:

"private": true,
  "proxy": {
    "api/v1/*": {
      "target": "localhost:4444"
    }
  },
  "dependencies": {...

How can this be fixed? What is wrong?

NewTech Lover
  • 1,185
  • 4
  • 20
  • 44
  • Possible duplicate: https://stackoverflow.com/questions/52605997/when-specified-proxy-in-package-json-must-be-a-string – neoto Jul 05 '19 at 09:39

2 Answers2

1

try adding

'http://' 
 "proxy": {
    "api/v1/*": {
      "target": "http://localhost:4444"
    }
  },

to your pacakge.json file

Jamie Taylor
  • 1,644
  • 1
  • 18
  • 42
Fizz.Han
  • 11
  • 1
1

The support of specifying the different paths in the package.json was dropped in create-react-app v2. To also support this functionality, you have to use a setupProxy.js.

For more information checkout the documentation here:

https://facebook.github.io/create-react-app/docs/proxying-api-requests-in-development#configuring-the-proxy-manually

Max Schmitt
  • 2,529
  • 1
  • 12
  • 26