Closed simon3073 closed 2 years ago
Describe the bug Not able to install package after setting up React CRA. After installing (using --force or --legacy-peer-deps) not able to build project via Netlify.
Package.json
"dependencies": { "@swc/helpers": "^0.4.2", "axios": "^0.27.2", "npm-check-updates": "^14.1.1", "parcel": "^2.5.0", "prop-types": "^15.8.1", "react": "^18.2.0", "react-bootstrap": "^2.4.0", "react-bootstrap-toggle": "^2.3.2", "react-dom": "^18.2.0", "react-icons": "^4.4.0", "react-redux": "^8.0.2", "react-router-dom": "^5.3.0", "redux": "^4.2.0", "redux-devtools-extension": "^2.13.9" }, "devDependencies": { "@parcel/transformer-sass": "^2.5.0", "buffer": "^6.0.3", "process": "^0.11.10" }
Error on install
npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: movie-api-client@1.0.0 npm ERR! Found: react@18.2.0 npm ERR! node_modules/react npm ERR! react@"^18.2.0" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer react@"^17.0.2 || ^16.0.2" from react-search-autocomplete@7.2.2 npm ERR! node_modules/react-search-autocomplete npm ERR! react-search-autocomplete@"*" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force, or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution. npm ERR!
Have tried downgrading to version 17.0.2 of React, but still not able to install without --force or --legacy-peer-deps.
Resolved: Added an Environmental variable in Netlify 'NPM_FLAGS' : '--legacy-peer-deps' Build succeeded
https://stackoverflow.com/questions/69351433/i-am-trying-to-host-my-react-website-on-netlify-but-there-is-a-npm-install-error
Added support for React 18 in version 8.0.0
8.0.0
Describe the bug Not able to install package after setting up React CRA. After installing (using --force or --legacy-peer-deps) not able to build project via Netlify.
Package.json
Error on install
Have tried downgrading to version 17.0.2 of React, but still not able to install without --force or --legacy-peer-deps.