Incompatible units: 'rem' and 'px' - Bootstrap 4 and Laravel Mix

╄→尐↘猪︶ㄣ 提交于 2019-11-30 17:05:01

Solved

  1. remove the bootstrap entry from package.json and replace it with "bootstrap": "4.0.0-alpha.6", in resources/assets/sass/app.scss,
  2. comment out the import of variables. change the path of bootstrap to @import "node_modules/bootstrap/scss/bootstrap.scss";
  3. in resources/assets/js/bootstrap.js, look for require('bootsrap-sass'); and change it to require('bootstrap');

Link!

It happened to me too, it's like you said, the override of some variables is the cause of this error.

To fix this just comment this line in resources/assets/sass/_variables:

$font-size-base: 14px;

In the variables if you need are using other variables that laravel provides.

reference: https://github.com/twbs/bootstrap/issues/18368

Just change the '$font-size-base: 14px;' to '$font-size-base: 0.875rem;' and run 'npm run dev'. And done.

I just fixed this on my side, what worked for me was moving the @import "bootstrap.scss.." and other variables to the top of the app.scss file, it seems it was overwritten and that is what caused the issue.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!