把angular项目从git拉去下拉后,通过npm install @angular/cli@9.1.12安装项目的node_module后,再通过ng serve启动项目时一直报错
报错信息如下:
ERROR in ./src/assets/custom-bootstrap-utilities.scss (./node_modules/css-loader/dist/cjs.js??ref--13-1!./node_modules/postcss-loader/src??embedded!./node_modules/sass-loader/disets/custom-bootstrap-utilities.scss)
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Can't find stylesheet to import.
╷
12 │ @import "../../node_modules/bootstrap/scss/_functions.scss";
查找资料说是安装node_module时没有使用淘宝镜像,重新使用淘宝镜像安装
npm install node-sass --registry=https://registry.npm.taobao.org
npm install @angular/cli@9.1.12
后启动项目仍然报错,报错信息如下
ERROR in ./src/assets/custom-bootstrap-utilities.scss (./node_modules/css-loader/dist/cjs.js??ref--13-1!./node_modules/postcss-loader/src??embedded!./node_modules/sass-loader/disets/custom-bootstrap-utilities.scss)
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Can't find stylesheet to import.
╷
12 │ @import "../../node_modules/bootstrap/scss/_functions.scss";
后又查询信息,需要安装node-sass
pm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm install node-sass
安装sass后仍然报错
Error: Node Sass version 5.0.0 is incompatible with ^4.0.0.
这个信息就很明显了,直接再卸载原先sass重新安装个版本4的sass即可。
npm uninstall node-sass
npm install node-sass@4.14.1
启动项目,successfully.
所以项目一开始就是报SassError,直接安装个npm install node-sass@4.14.1应该就可以了!