Module build failed (from ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/sass-loader/dist/cjs.js): 16:25:51.767 SassError: Undefined variable: "$u-border-color". 16:25:51.776 on line 38 of ../../../articleDemo/uni_modules/uview-ui/libs/css/common.scss 16:25:51.786 from line 2 of ../../../articleDemo/uni_modules/uview-ui/index.scss 16:25:51.794 from line 68 of D:\计算机学习\Hbuilder\articleDemo\App.vue 16:25:51.803 >> border-color: $u-border-color!important; 16:25:51.814 ---------------^
时间: 2024-01-28 14:05:22 浏览: 695
这个错误是由于在编译过程中找不到变量`$u-border-color`导致的。要解决这个问题,你需要确保在引入`common.scss`文件之前定义了`$u-border-color`变量。
你可以在你的项目中找到`common.scss`文件,并确保在使用`$u-border-color`变量之前定义了它。你可以通过以下方式定义变量:
```scss
$u-border-color: #000; // 这里可以是任何颜色值
```
确保将其放在使用该变量的地方之前,然后重新构建你的项目,看看是否还会出现同样的错误。
相关问题
Module build failed (from ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/sass-loader/dist/cjs.js)
As an AI language model, I don't have access to your system and codebase. However, this error message indicates that there was an issue with building a module from the sass-loader package. Here are some common solutions that you can try:
1. Make sure that you have the latest version of sass-loader installed. You can do this by running the command `npm install sass-loader --save-dev`.
2. Check if there are any conflicting versions of sass-loader or other dependencies. You can try removing the node_modules folder and reinstalling all dependencies using the command `npm install`.
3. Check if your project's configuration is correct. Make sure that your webpack configuration file is set up correctly for using sass-loader.
4. If you are using Vue CLI, try running the command `vue add sass` to add the sass-loader plugin to your project.
If none of these solutions work, you may need to provide more information about your project and error message for further help.
uni-app 出现Module build failed (from ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/sass-loader/dist/cjs.js)错误
这个错误通常是由于 sass-loader 版本不兼容导致的。您可以尝试以下方法解决此问题:
1.升级 sass-loader 版本
在 package.json 文件中查找 sass-loader 版本,将其升级到最新版本:
```
"devDependencies": {
"sass-loader": "^10.0.5",
// ...
}
```
然后执行 `npm install` 更新依赖。
2.降级 sass-loader 版本
如果升级 sass-loader 后仍然出现错误,可以尝试降级 sass-loader 版本:
```
"devDependencies": {
"sass-loader": "^8.0.2",
// ...
}
```
然后执行 `npm install` 更新依赖。
3.安装 node-sass
如果升级或降级 sass-loader 后仍然出现错误,可以尝试安装 node-sass:
```
npm install node-sass
```
然后再次运行项目。
阅读全文
相关推荐














