Skip to content
Advertisement

Error: File to import not found or unreadable: ~bootstrap/scss/bootstrap

I followed the instructions at getbootstrap.com thinking that everything would just work. It isn’t so far :

Everything seems to be fine until I try to load the page, at which point my Express.js app throws the error

JavaScript

I have tried npm install, restarting my server, looking on Google, StackOverflow (yes, I know there are quite a few similar questions, but none of them answer my question), the Bootstrap 4 GitHub issue pages and so far I haven’t been able to come up with the answer.

Could it be that I installed the dependencies in the wrong place? (Dev instead of production or vis-à-vis)

Why am I getting this error??

My webpack.config.js file looks like this…

JavaScript

My package.json file

JavaScript

postcss.config.js

JavaScript

and inside app.scss I have

JavaScript

Advertisement

Answer

When Sass is precompiled by its own CLI, it processes @imports by itself, and sometimes thus doesn’t understand ~ notation. So you can import "node_modules/bootstrap/scss/bootstrap"; in first place and replaced the ~ notation with node_modules/ instead.

Advertisement