Search code examples
reactjsherokunpmpackage.json

Production React App Failing with Minified React error #321


I have this error when I deploy my project to Heroku. It works in Local. I got this error after taking this Nav Bar from TalwindUI

https://tailwindui.com/components/application-ui/navigation/navbars


        "dependencies": {},
        "devDependencies": {
          "@types/react": "^17.0.0",
          "@types/react-dom": "^17.0.0",
          "react": ">=17.0.1",
          "react-dom": ">=17.0.1"
        },
    
    "dependencies": {
        "@craco/craco": "^6.1.0",
        "@headlessui/react": "^1.3.0",
        "@heroicons/react": "^1.0.2",
        "@tailwindcss/postcss7-compat": "^2.0.2",
        "@testing-library/jest-dom": "^5.11.9",
        "@testing-library/react": "^11.2.3",
        "@testing-library/user-event": "^12.6.2",
        "autoprefixer": "^9.8.6",
        "body-parser": "^1.19.0",
        "chart.js": "^2.9.4",
        "concurrently": "*",
        "cors": "^2.8.5",
        "dotenv": "^8.2.0",
        "express": "^4.17.1",
        "heroicons": "^1.0.2",
        "highcharts": "^9.0.1",
        "highcharts-react-official": "^3.0.0",
        "lodash": "^4.17.20",
        "material-design-icons": "^3.0.1",
        "mongoose": "^5.11.18",
        "node-cron": "^2.0.3",
        "postcss": "^7.0.35",
        "react-chartjs-2": "^2.11.1",
        "react-d3-speedometer": "^1.0.1",
        "react-router-dom": "^5.2.0",
        "react-scripts": "4.0.1",
        "react-slick": "^0.28.0",
        "react-spinners-kit": "^1.9.1",
        "react-table": "^7.6.3",
        "recharts": "^2.0.4",
        "slick-carousel": "^1.8.1",
        "tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.0.2",
        "web-vitals": "^0.2.4",
        "websocket": "^1.0.33"
    },

Solution

  • I had multiples package.json files (server and client in my mono repo). The problem was mismatched versions of react and react-dom. I resolved the problem by removing duplicate dependencies in both files and made sure to use the same version.