Sass错误:导入引导程序时找不到要导入的样式表

Jos*_*p95 3 css import sass bootstrap-5

我正在尝试使用 npm 将 bootstrap 添加到我的目录。\n这是我的文件结构:

\n

在此输入图像描述

\n

我在 style.scss 文件中使用 @import

\n
@import "../node_modules/bootstrap/scss/bootstrap";\n
Run Code Online (Sandbox Code Playgroud)\n

我的 package.json 看起来像这样。它基本上是来自此站点的入门小子 -\n minus-static-site-sass-setup

\n
{\n"name": "playground",\n"version": "0.1.0",\n"description": "SASS compile|autoprefix|minimize and live-reload dev server using Browsersync for static HTML",\n"main": "public/index.html",\n"author": "5t3ph",\n"scripts": {\n    "build:sass": "sass  --no-source-map src/sass:public/css",\n    "copy:assets": "copyfiles -u 1 ./src/assets/**/* public",\n    "copy:html": "copyfiles -u 1 ./src/*.html public",\n    "copy": "npm-run-all --parallel copy:*",\n    "watch:assets": "onchange \\"/src/assets/**/*\\" -- npm run copy:html",\n    "watch:html": "onchange \\"src/*.html\\" -- npm run copy:html",\n    "watch:sass": "sass  --no-source-map --watch src/sass/:public/css",\n    "watch": "npm-run-all --parallel watch:*",\n    "serve": "browser-sync start --server public --files public",\n    "start": "npm-run-all copy --parallel watch serve",\n    "build": "npm-run-all copy:html build:*",\n    "postbuild": "postcss public/css/*.css -u autoprefixer cssnano -r --no-map"\n},\n"dependencies": {\n    "autoprefixer": "^10.4.2",\n    "bootstrap": "^5.1.3",\n    "browser-sync": "^2.27.7",\n    "copyfiles": "^2.4.1",\n    "cssnano": "^5.0.17",\n    "npm-run-all": "^4.1.5",\n    "onchange": "^7.1.0",\n    "postcss-cli": "^9.1.0",\n    "sass": "^1.49.8"\n}\n
Run Code Online (Sandbox Code Playgroud)\n

}

\n

每次我尝试编译它时,都会收到此错误:

\n
"Error: Can\'t find stylesheet to import.\n  \xe2\x95\xb7\n6 \xe2\x94\x82 @import "../node_modules/bootstrap/scss/bootstrap";\n  \xe2\x94\x82         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  \xe2\x95\xb5\n  src\\sass\\style.scss 6:9  root stylesheet"\n
Run Code Online (Sandbox Code Playgroud)\n

我尝试了 stackoverflow 中的许多潜在解决方案,但似乎没有一个适合我。

\n

知道吗,我做错了什么?

\n

Jos*_*p95 8

@import "../../node_modules/bootstrap/scss/bootstrap";
Run Code Online (Sandbox Code Playgroud)

错误的路径,这就是问题所在:)