Angular: Module build failed (from ./node_modules/[email protected]@sass-loader/lib/loader.js):

场景:当 ng serve  启动项目  时,会报错:

ERROR in ./src/sass/styles.scss (./node_modules/_@[email protected]@@angular-devkit/build-angular/src/angularss-loader.js!./node_modules/[email protected]@postcss-loader/src??embedded!./node_modules/[email protected]@sass-loader/li/src/sass/styles.scss)
Module build failed (from ./node_modules/[email protected]@sass-loader/lib/loader.js):

undefined
       ^
      Invalid parent selector "[type=button]"
   ╷
12 │         &:link, &a:visited {
   │         ^^^^^^^^^^^^^^^^^^^
   ╵
  src\sass\05-atoms\buttons.scss 12:9  @import
  stdin 99:9                           root stylesheet
      in D:\xxx\src\sass\05-atoms\buttons.scss (line 12, column 9)

我的本地环境:

Angular CLI: 6.0.5
Node: 10.17.0
OS: win32 x64
Angular: 6.1.9

 原因

node node-sass sass-loader 版本不匹配

解决:

cnpm install [email protected]

 Tips: 具体哪个版本需要根据自己的环境而定,反正我的本地环境在安装了[email protected]之后,可以正常启动了。

你可能感兴趣的:(前端,angular)