jufrensius's avatar

Laravel Mix fails while running npm run dev after installing Sweetalert2

ERROR in ./resources/sass/app.scss Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js): ModuleBuildError: Module build failed (from ./node_modules/sass-loader/dist/cjs.js): SassError: Undefined function. ╷ 516 │ $icon-zoom: math.div(strip-units($swal2-icon-size), 5); │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ╵ node_modules\sweetalert2\src\scss_core.scss 516:13 @import node_modules\sweetalert2\src\scss_theming.scss 8:9 @import node_modules\sweetalert2\src\sweetalert2.scss 4:9 @import

0 likes
5 replies
jufrensius's avatar

Thank you for your reply.

I just downgraded from the latest version to version 11.0.12 and added this line "const Swal = window.Swal = require('sweetalert2');" into bootstrap.js file, added this line "@import '~sweetalert2/src/sweetalert2.scss';" into app.scss and I faced the same error.

frankielee's avatar

Also, what else you have installed.

What else you have installed?

Check your package.json

Usually this issue is due to the sass version issue.

jufrensius's avatar

Hi,

I installed these plugins

"dependencies": { "@fortawesome/fontawesome-free": "^5.15.4", "admin-lte": "^3.1.0", "chartjs-plugin-datalabels": "^2.0.0", "datatables.net-bs4": "^1.10.24", "datatables.net-buttons-bs4": "^1.7.0", "echarts": "^5.1.2", "sweetalert2": "^11.0.12" }

If this issue is the sass version, how to check the sass version and how to upgrade it? Thank you

Please or to participate in this conversation.