输入npm install
报以下错误
npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! node-sass@4.13.1 postinstall: `node scripts/build.js` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the node-sass@4.13.1 postinstall script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
1.这个是因为sass安装时获取源的问题,修改sass安装的源,使用taobao的npm
npm config set sass_binary_site=https://npm.taobao.org/mirrors/node-sass
然后运行
npm install
2.也可直接使用npm直接下载淘宝的scss
npm install node-sass --sass-binary-site=http://npm.taobao.org/mirrors/node-sass
本文出自:
https://www.cnblogs.com/pxblog/p/12444050.html
vue cli3使用官方方法配置sass全局变量报错
vue.config.js代码如下:
module.exports = { css: { loaderOptions: { sass: { data: `@import "~@/assets/scss/variables.scss";`, }, } } }
variables.scss的代码如下:
$theme-color: #33aef0;
app.vue代码如下
#app { color: $theme-color; }
// 旧 data: `@import "~@/assets/scss/variables.scss";` // 新 prependData: `@import "~@/assets/scss/variables.scss";`
改用新版本即可
本文出自:
https://segmentfault.com/q/1010000020343645