前面已使用vue-cli新建了一个vue项目,参考 使用命令行建立一个vue项目的所有命令及结果css
首先看下新建项目的页面和代码,有部分修改,可忽视,以下图:html
而后咱们在页面添加sass的代码:vue
修改完保存后当即就报错了:node
在使用scss以前,咱们首先须要安装相关的插件: 这里参考的是:连接( vue 项目 使用sass )webpack
$ npm install node-sass --save-dev
> node-sass@4.9.0 install F:\05 poverty alleviation project\poverty\node_modules\node-sass
> node scripts/install.js
Cached binary found at D:\nodejs\node_cache\node-sass\4.9.0\win32-x64-57_binding.node
> node-sass@4.9.0 postinstall F:\05 poverty alleviation project\poverty\node_modules\node-sass
> node scripts/build.js
Binary found at F:\05 poverty alleviation project\poverty\node_modules\node-sass\vendor\win32-x64-57\binding.node
Testing binary
Binary is fine
npm WARN ajv-keywords@3.2.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ node-sass@4.9.0
added 73 packages from 83 contributors and audited 33411 packages in 40.38s
found 16 vulnerabilities (1 low, 10 moderate, 4 high, 1 critical)
run `npm audit fix` to fix them, or `npm audit` for details
$ npm install sass-loader --save-dev
npm WARN ajv-keywords@3.2.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ sass-loader@7.0.3
added 9 packages from 17 contributors and audited 33431 packages in 15.084s
found 16 vulnerabilities (1 low, 10 moderate, 4 high, 1 critical)
run `npm audit fix` to fix them, or `npm audit` for details
安装完从新启动项目,以下图,咱们看到页面是能够正常显示了,用scss写的样式也起了做用哦 :)web
这里不一样于参考连接的是,不须要配置参考文说到的webpack.base.config.js,但是也能正常使用了。vue-cli
而安装上面的插件也是一次性就安装成功的,没有出现别的问题。npm
谁知道缘由的能够留言哦,新手不是很懂这些配置文件。sass