user1173465
user1173465

Reputation: 53

Build and deploy task gives errors after React upgrade from 16 to 18

I am able to upgrade React App from version 16 to 18 and working fine in the Local server, but gives an errors while deploying through Github.

I got the following errors.

npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: @material-ui/[email protected]
npm error Found: [email protected]
npm error node_modules/react
npm error   react@"^18.3.1" from the root project
npm error   peer react@">=16.8.0" from @emotion/[email protected]
npm error   node_modules/@emotion/react
npm error     @emotion/react@"^11.14.0" from the root project
npm error   17 more (@emotion/use-insertion-effect-with-fallbacks, ...)
npm error
npm error Could not resolve dependency:
npm error peer react@"^16.8.0" from @material-ui/[email protected]
npm error node_modules/@material-ui/core
npm error   @material-ui/core@"^4.11.0" from the root project
npm error   peer @material-ui/core@"^4.0.0" from @material-ui/[email protected]
npm error   node_modules/@material-ui/icons
npm error     @material-ui/icons@"^4.9.1" from the root project
npm error   1 more (@material-ui/lab)
npm error
npm error Conflicting peer dependency: [email protected]
npm error node_modules/react
npm error   peer react@"^16.8.0" from @material-ui/[email protected]
npm error   node_modules/@material-ui/core
npm error     @material-ui/core@"^4.11.0" from the root project
npm error     peer @material-ui/core@"^4.0.0" from @material-ui/[email protected]
npm error     node_modules/@material-ui/icons
npm error       @material-ui/icons@"^4.9.1" from the root project
npm error     1 more (@material-ui/lab)
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.

Here is my package.json file

{
    "name": "myapp",
    "version": "0.1.0",
    "private": true,
    "dependencies": {
        "@emotion/react": "^11.14.0",
        "@fortawesome/fontawesome-svg-core": "^1.2.30",
        "@fortawesome/free-solid-svg-icons": "^5.14.0",
        "@fortawesome/react-fontawesome": "^0.2.0",
        "@hookform/error-message": "0.0.4",
        "@material-ui/core": "^4.11.0",
        "@material-ui/icons": "^4.9.1",
        "@material-ui/lab": "^4.0.0-alpha.56",
        "@testing-library/jest-dom": "^4.2.4",
        "@testing-library/react": "^9.3.2",
        "@testing-library/user-event": "^7.1.2",
        "acorn": "^7.4.0",
        "axios": "^0.19.2",
        "bootstrap": "^4.5.2",
        "customize-cra": "^1.0.0",
        "history": "^5.0.0",
        "jquery": "^3.5.1",
        "js-file-download": "^0.4.12",
        "jwt-decode": "^3.1.2",
        "latest": "^0.2.0",
        "material-ui-icons": "^1.0.0-beta.36",
        "moment": "^2.29.1",
        "react": "^18.3.1",
        "react-app-rewired": "^2.1.6",
        "react-autosuggest": "^10.0.2",
        "react-dom": "^18.3.1",
        "react-google-charts": "^3.0.15",
        "react-hook-form": "^6.9.2",
        "react-loading": "^2.0.3",
        "react-moment": "^1.0.0",
        "react-multi-select-component": "^3.0.5",
        "react-router-dom": "^5.2.0",
        "react-scripts": "^3.4.3",
        "react-toastify": "^6.0.8",
        "reactstrap": "^8.5.1",
        "recharts": "^1.8.5",
        "typescript": "^3.7.0-beta",
        "usa-states": "0.0.5",
        "uuid": "^8.3.0",
        "watchpack-chokidar2": "^2.0.1"
    },
    "scripts": {
        "start": "react-app-rewired start",
        "build": "CI=false react-app-rewired build",
        "test": "react-app-rewired test",
        "eject": "react-app-rewired eject"
    },
    "eslintConfig": {
        "extends": "react-app"
    },
    "browserslist": {
        "production": [
            ">0.2%",
            "not dead",
            "not op_mini all"
        ],
        "development": [
            "last 1 chrome version",
            "last 1 firefox version",
            "last 1 safari version"
        ]
    },
    "devDependencies": {
        "@testing-library/dom": "^5.6.1",
        "cors": "^2.8.5",
        "eslint": "^6.8.0",
        "eslint-config-airbnb": "^18.2.0",
        "eslint-config-prettier": "^6.11.0",
        "eslint-plugin-import": "^2.22.0",
        "eslint-plugin-jsx-a11y": "^6.3.1",
        "eslint-plugin-prettier": "^3.1.4",
        "eslint-plugin-react": "^7.20.6",
        "eslint-plugin-react-hooks": "^2.5.1",
        "express": "^4.17.1",
        "popper.js": "^1.16.1",
        "prettier": "^2.1.1"
    }
}

Upvotes: 0

Views: 29

Answers (0)

Related Questions