How can I downgrade project created with "npx create-react-app . --template typescript". All posts I find online suggest manually changing dependencies then to run "npm install" but there's always some error when I do that. How can I modify dependencies to make it work with react v17 ?
here's my attempt to downgrade :
"dependencies": {
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.2.0",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^27.5.1",
"@types/node": "^16.11.36",
"@types/react": "^17.0.2",
"@types/react-dom": "^17.0.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "5.0.1",
"typescript": "^4.6.4",
"web-vitals": "^2.1.4"
}
and here is errors:
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: hard-keys-react17@0.1.0
npm WARN Found: react@18.1.0
npm WARN node_modules/react
npm WARN react@"^17.0.2" from the root project
npm WARN 3 more (@testing-library/react, react-dom, react-scripts)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^18.0.0" from @testing-library/react@13.2.0
npm WARN node_modules/@testing-library/react
npm WARN @testing-library/react@"^13.2.0" from the root project
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: hard-keys-react17@0.1.0
npm WARN Found: react@18.1.0
npm WARN node_modules/react
npm WARN react@"^17.0.2" from the root project
npm WARN 3 more (@testing-library/react, react-dom, react-scripts)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^18.1.0" from react-dom@18.1.0
npm WARN node_modules/react-dom
npm WARN react-dom@"^17.0.2" from the root project
npm WARN 1 more (@testing-library/react)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: hard-keys-react17@0.1.0
npm WARN Found: react-dom@18.1.0
npm WARN node_modules/react-dom
npm WARN react-dom@"^17.0.2" from the root project
npm WARN 1 more (@testing-library/react)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react-dom@"^18.0.0" from @testing-library/react@13.2.0
npm WARN node_modules/@testing-library/react
npm WARN @testing-library/react@"^13.2.0" from the root project
You could always run
npm resolve dependencies
Manually downgrading might throw some warning tell you that there are newer version than the one you are using now but its still work all the same.
And you made a mistake in your package.json
"react-scripts": "5.0.1",
Make it
"react-scripts": "^5.0.1",