我进入浏览器时出错,已附上以供参考。

我正在遵循的步骤来清理编译我的项目:
rm -rf package-lock.json
rm -rf node_modules/
rm -rf build/
npm install
npm run build 我的package.json文件包含以下数据:
{
"name": "dashboard",
"version": "1.0.1",
"description": "Dashboard",
"author": "Inc.",
"private": true,
"scripts": {
"analyze": "source-map-explorer 'build/static/js/*.js'",
"start": "PORT=3006 react-scripts start",
"build": "react-scripts build"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 10",
"not op_mini all"
],
"dependencies": {
"@date-io/core": "1.3.13",
"@date-io/date-fns": "1.3.13",
"@fullcalendar/core": "4.4.2",
"@fullcalendar/daygrid": "4.4.2",
"@fullcalendar/interaction": "4.4.2",
"@fullcalendar/react": "4.4.2",
"@material-ui/core": "4.11.0",
"@material-ui/docs": "4.0.0-beta.3",
"@material-ui/icons": "4.9.1",
"@material-ui/lab": "4.0.0-alpha.56",
"@material-ui/pickers": "3.2.10",
"@material-ui/styles": "4.10.0",
"@material-ui/system": "4.9.14",
"@reduxjs/toolkit": "1.4.0",
"@sentry/react": "5.30.0",
"@sentry/tracing": "6.0.4",
"@types/dragula": "3.7.0",
"@types/google-map-react": "1.1.8",
"@types/react": "16.9.46",
"@types/react-dom": "16.9.8",
"@types/react-helmet": "5.0.16",
"@types/react-redux": "7.1.9",
"@types/react-router-dom": "5.1.5",
"@types/react-syntax-highlighter": "11.0.4",
"@types/redux-logger": "3.0.8",
"@types/styled-components": "5.1.2",
"axios": "0.21.1",
"chart.js": "2.9.3",
"css-vendor": "2.0.8",
"date-fns": "2.15.0",
"google-map-react": "1.1.7",
"immer": "9.0.3",
"json-logic-js": "2.0.1",
"jss": "10.4.0",
"material-ui-dropzone": "2.5.0",
"moment": "2.29.1",
"polished": "3.6.5",
"prop-types": "15.7.2",
"react": "16.13.1",
"react-app-polyfill": "1.0.6",
"react-chartjs-2": "2.10.0",
"react-date-range": "1.1.3",
"react-datetime": "3.0.4",
"react-diff-viewer": "3.1.1",
"react-dom": "16.13.1",
"react-dragula": "1.1.17",
"react-feather": "2.0.8",
"react-google-login": "5.1.23",
"react-helmet": "5.2.1",
"react-jvectormap": "0.0.16",
"react-perfect-scrollbar": "1.5.8",
"react-quill": "1.3.5",
"react-redux": "7.2.1",
"react-router": "5.2.1",
"react-router-dom": "5.2.0",
"react-scripts": "3.4.3",
"react-syntax-highlighter": "13.5.0",
"redux": "4.0.5",
"redux-logger": "3.0.6",
"styled-components": "5.1.1",
"typescript": "3.9.7",
"universal-cookie": "4.0.4"
},
"devDependencies": {
"@types/json-logic-js": "1.2.1",
"@types/react-date-range": "1.1.4",
"source-map-explorer": "2.5.2"
}
}让我知道什么会突然改变,同样的代码不再工作。
更多详细信息:
$ npm -v
8.0.0$ node -v
v16.11.1编辑1:
行129 Function.prototype.apply.call(originalConsoleLevel,global.console,args);

发布于 2021-10-18 19:41:02
我猜问题出在package.json文件中的"jss":"10.4.0“。Material UI也有依赖关系,正在添加"jss":"^10.0.3“。我猜可能是由于冲突,它导致了replaceRule函数问题。
发布于 2021-10-19 07:29:58
好的,如果你在你的项目上运行
npm ls jss它将列出所有使用jss npm ls result的包。
如您所见,我使用的是jss 10.5.1,而material-ui/styles使用的是10.8.0,我所要做的就是升级jss的版本,使其与mui/styles使用的版本相匹配
npm install jss@10.8.0这使得它可以工作,我也建议您在实际使用jss的项目中查看一下,看看是否可以避免它
https://stackoverflow.com/questions/69620920
复制相似问题