生产 React 应用程序因缩小 React 错误而失败 #321
Production React App Failing with Minified React error #321
我在将项目部署到 Heroku 时出现此错误。它在本地工作。
从 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"
},
我有多个 package.json
文件(我的单声道存储库中的服务器和客户端)。问题是 react
和 react-dom
的版本不匹配。我通过删除两个文件中的重复依赖项并确保使用相同的版本解决了这个问题。
我在将项目部署到 Heroku 时出现此错误。它在本地工作。 从 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"
},
我有多个 package.json
文件(我的单声道存储库中的服务器和客户端)。问题是 react
和 react-dom
的版本不匹配。我通过删除两个文件中的重复依赖项并确保使用相同的版本解决了这个问题。