【发布时间】:2020-04-28 04:02:31
【问题描述】:
我目前使用的是旧版本的 React Script 版本 1.5.1。我想升级我的 react 应用程序(react-scripts v 3.4.1),但这样做会破坏 package.json 中定义的代理结构。
我当前的 JSON 有
"proxy": {
"/ossapi": {
"target": "http://localhost:8002"
},
"/pcp": {
"target": "http://test.corp.test.com:8004"
},
"/ossOps": {
"target": "http://test.corp.test.com:8085"
},
"/ems": {
"target": "http://test.corp.test.com:8001"
}
}
即使在我升级到新的 React-scripts 版本 3.4.1 之后,我也希望为我的应用程序设置类似的设置,因为我已经进行了大量开发并且不想再次从头开始。 当我将 react-scripts 版本更改为最新的稳定版 3.4.1 时,它不断抛出 failed to parse json 错误。
请指教。
以下是我得到的错误:
npm ERR! code EJSONPARSE
npm ERR! file /Users/dhrumit.sheth/Documents/Dev/stash/console-app/package.json
npm ERR! JSON.parse Failed to parse json
npm ERR! JSON.parse Unexpected token } in JSON at position 1438 while parsing near '...git push --tags",
npm ERR! JSON.parse },
npm ERR! JSON.parse "proxy": [
npm ERR! JSON.parse "/os...'
npm ERR! JSON.parse Failed to parse package.json data.
npm ERR! JSON.parse package.json must be actual JSON, not just JavaScript.
【问题讨论】:
标签: reactjs create-react-app react-scripts