我的应用程序总是无法创建npm版本,它抛出错误
> react-scripts build
Creating an optimized production build...
Failed to compile.
Cannot read property 'toLowerCase' of undefined
CompileError: Begins at CSS selector input.advert:focus
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! public@0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the public@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:这对我来说有点难调试,因为我已经删除了所有的toLowerCase方法,甚至搜索了项目全局返回0,但我仍然得到这可能是正在使用的模块还是什么?
我的包里有
"@ckeditor/ckeditor5-build-classic": "^20.0.0",
"@ckeditor/ckeditor5-react": "^2.1.0",
"axios": "^0.18.0",
"chart.js": "^2.9.4",
"node-sass": "^4.14.1",
"qrcode.react": "^1.0.0",
"query-string": "^6.13.7",
"react": "^16.14.0",
"react-addons-css-transition-group": "^15.6.2",
"react-chartjs-2": "^2.11.1",
"react-dnd": "^5.0.0",
"react-dom": "^16.14.0",
"react-dropzone": "^11.2.4",
"react-image-crop": "^8.6.6",
"react-image-magnify": "^2.7.4",
"react-redux": "^7.2.2",
"react-router-dom": "^5.2.0",
"react-scripts": "^3.4.4",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0",
"tiny-slider-react": "^0.4.0",
"tsutils": "^3.17.1",
"typescript": "^3.9.7",
"underscore": "^1.12.0"会很感谢你帮我摆脱这一切的
发布于 2020-12-16 14:19:52
由于某些原因我也不明白,问题不是JavaScript的问题,而是CSS,
input.advert:focus {
border: 0px;
border-bottom: 1px solid lightgrey;
box-shadow: none;
border-color: none;
}上面的CSS似乎不允许构建包,当我删除它时,编译现在通过
也许可以解释,或者不支持:focus,可能是因为:active具有相同的样式,但工作正常
https://stackoverflow.com/questions/65315375
复制相似问题