The setup takes three commands. npm install sass bootstrap, one line of SCSS, one compile. The compile fails, and the real error sits under a deprecation warning that has nothing to do with it:
$ printf "@import 'bootstrap';\n" > src/main.scss
$ npx sass src/main.scss out.css
DEPRECATION WARNING [import]: Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.
More info and automated migrator: https://sass-lang.com/d/import
╷
1 │ @import 'bootstrap';
│ ^^^^^^^^^^^
╵
src/main.scss 1:9 root stylesheet
Error: Can't find stylesheet to import.
╷
1 │ @import 'bootstrap';
│ ^^^^^^^^^^^
╵
src/main.scss 1:9 root stylesheet
$ echo $?
65
The reason fits in one sentence. Dart Sass does not look in node_modules. Node’s require() checks that folder, and so do webpack and Vite. Sass only searches the folder your file is in and any load paths you name. Every tutorial where @import 'bootstrap' “just works” set a load path somewhere you weren’t looking, usually in a bundler config three files away. This hack comes out of it-journey.dev’s Digital Artist quest report, where the import died in exactly this way.
The usual answer is “add --load-path=node_modules.” That’s correct, and it isn’t enough on its own. I tested every import setup I could think of and kept the one that broke the advice.
The gauntlet
Everything below ran on Node 24.22.3, Dart Sass 1.108.2 and Bootstrap 5.3.9, in a project created with npm init -y && npm i sass bootstrap. “Warnings” is the count of DEPRECATION WARNING blocks Sass printed before it stopped printing them.
| # | Import line | Flags | Exit | Result |
|---|---|---|---|---|
| 1 | @import 'bootstrap' |
none | 65 | ❌ Can’t find stylesheet |
| 2 | @import 'bootstrap' |
--load-path=node_modules |
65 | ❌ Can’t find stylesheet, with the flag |
| 3 | @import 'bootstrap/scss/bootstrap' |
--load-path=node_modules |
0 | ✅ 277,271 bytes, 20 warnings shown + 311 “omitted” |
| 4 | @use 'bootstrap/scss/bootstrap' |
none | 65 | ❌ Can’t find stylesheet |
| 5 | @use 'bootstrap/scss/bootstrap' |
--load-path=node_modules |
0 | ✅ 277,271 bytes, 20 warnings + 310 omitted |
| 6 | @use 'bootstrap/scss/bootstrap' |
-I node_modules |
0 | ✅ same thing, shorter flag |
| 7 | @use 'pkg:bootstrap' |
none | 65 | ❌ Can’t find stylesheet |
| 8 | @use 'pkg:bootstrap' |
--pkg-importer=node |
0 | ✅ 277,271 bytes |
| 9 | @import '~bootstrap/scss/bootstrap' |
--load-path=node_modules |
65 | ❌ the webpack ~ means nothing to Sass |
| 10 | @use 'bootstrap/scss/bootstrap' |
--load-path=node_module (typo) |
65 | ❌ no warning that the folder doesn’t exist |
Then I diffed the outputs. After I stripped the sourceMappingURL comment, rows 3, 5, 6 and 8 hashed to the same MD5, ddd9e536…. They’re four ways to write one stylesheet.
Row 2 is why this hack exists. The flag adds node_modules to the search path, so Sass looks for node_modules/bootstrap.scss, node_modules/bootstrap/_index.scss and node_modules/bootstrap/index.scss. None of them exist. Bootstrap ships its Sass entry point at scss/bootstrap.scss:
$ ls node_modules/bootstrap
LICENSE README.md dist js package.json scss
$ node -p 'require("bootstrap/package.json").sass'
scss/bootstrap.scss
The flag and the full path are two separate fixes, and the error message is identical until you’ve made both. If you add the flag, still see Can't find stylesheet to import., and decide the flag doesn’t work, you’ll go looking for a different fix you don’t need.
Row 4 settles a common hope. Moving from @import to @use doesn’t change how files are found. Both use the same load paths. @use needs the flag exactly as much as @import did.
Row 8 is the newer route. Sass 1.71 added a Node package importer. pkg:bootstrap reads that "sass": "scss/bootstrap.scss" field in Bootstrap’s package.json and finds the entry point itself. You still need the flag, though. This time it’s --pkg-importer=node, and without it you get the same error. Every failing row in this table fails with that one message.
The fix
npm i sass bootstrap
// src/main.scss: the full path, not the package name
@use 'bootstrap/scss/bootstrap';
"scripts": {
"build:css": "sass --load-path=node_modules --quiet-deps --no-error-css src/main.scss dist/main.css"
}
I added two more flags after more breakage.
--quiet-deps mutes 331 warnings that aren’t yours. With --verbose, row 3 printed 331 DEPRECATION WARNING blocks. They’re about @import, global built-in functions and color math inside Bootstrap’s own source, and you can’t fix any of them in your code. Without the flag you get 20 of them and a note about the rest, and any warning about your file is lost in that pile. With --quiet-deps, the @use build printed zero, and the CSS hashed the same as before.
--no-error-css stops a failed build from shipping its error. When Dart Sass fails while writing to a file, it still writes that file by default. I opened the t.css that row 9 left behind:
/* Error: Can't find stylesheet to import.
* ,
* 1 | @import '~bootstrap/scss/bootstrap';
...
body::before {
font-family: "Source Code Pro", "SF Mono", Monaco, Inconsolata, "Fira Mono",
"Droid Sans Mono", monospace, monospace;
white-space: pre;
...
content: "Error: Can't find stylesheet to import.\a ...";
}
That’s a 645-byte stylesheet that prints the compiler error across the top of your page. The exit code is 65, so a careful pipeline stops there. A pipeline that ignores the exit code deploys it, and visitors see a compiler error where your site’s styles should be. With --no-error-css, the failed build exited 65 and wrote no file.
The load path is relative to where you run the command, not to the SCSS file. I ran cd src && npx sass --load-path=node_modules c.scss ../k.css and got exit 65. From src/, the path has to be ../node_modules. Putting the command in an npm script avoids this, because npm runs scripts from the package root. From inside src/, npm run build:css exited 0 and wrote 277,274 bytes.
The advice to switch to node-sass
The other answer you’ll find is to uninstall sass and install node-sass, because it “finds node_modules.” I installed it so you don’t have to:
$ npm view node-sass version deprecated
version = '9.0.0'
deprecated = 'Node Sass is no longer supported. Please use `sass` or `sass-embedded` instead.'
$ npm i node-sass
added 202 packages, and audited 203 packages in 2m
...
10 vulnerabilities (2 low, 7 high, 1 critical)
$ npx node-sass --version
node-sass 9.0.0 (Wrapper) [JavaScript]
libsass 3.5.5 (Sass Compiler) [C/C++]
The install took two minutes because it compiled LibSass, its C++ core, from source. It came with a critical-severity vulnerability. And it still doesn’t search node_modules on its own: I had to pass --include-path node_modules, its name for the same flag. With that, @import 'bootstrap/scss/bootstrap' compiled to 272,864 bytes, so Bootstrap 5.3.9 does still build under LibSass.
Then I gave it the @use line, which is the modern syntax and the one row 5 needs:
$ npx node-sass --include-path node_modules u.scss -o out
$ echo $?
0
$ cat out/u.css
@use 'bootstrap/scss/bootstrap';
It exited 0 and wrote a 33-byte file that is your @use line, unchanged. LibSass predates the module system, so it didn’t recognise @use as Sass and passed it through as if it were CSS. There was no error and no warning. A browser that hits an @use rule ignores it, so your page renders unstyled, and your CI log says the build succeeded. Out of ten import setups and two compilers, that’s the only failure that reports success.
Verdict
--load-path=node_modules plus @use 'bootstrap/scss/bootstrap' holds up on a bad Tuesday. You can rename the flag to -I, swap to pkg: with --pkg-importer=node or switch from @import to @use, and the CSS is byte-identical. It won’t survive the intern, who will still run it from src/ or typo the path. Sass says nothing about a folder that doesn’t exist, so put the command in an npm script and let the script set the working directory. Leave node-sass alone. It’s deprecated, and it’s the only setup here that exits 0 after doing nothing.