AspNetCore Angular 6.0 SPA模板中的未知选项--extractCss [英] Unknown option --extractCss in AspNetCore Angular 6.0 SPA Template

查看:313
本文介绍了AspNetCore Angular 6.0 SPA模板中的未知选项--extractCss的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从cli脚手架上安装了AspNetCore Angular 6.0 SPA template,然后相应地安装了npm软件包.

I have scaffolded AspNetCore Angular 6.0 SPA template from cli and then installed npm package accordingly.

但是,当我尝试运行项目dotnet run时,它不会启动,而是提示您并出现错误.我已经捕获了一个屏幕截图,供您参考.我不确定与angular.Json file是否有关!!!!任何想法.

However when i try to run the project dotnet run it does not start rather prompted with and error. I have captured a screenshot for your reference. I am not sure whether it is something to do with angular.Json file or else!!! Any idea..

错误:

未知选项--extractCss

Unknown option --extractCss

推荐答案

这是因为ng serve命令不再支持--extractCss选项

This is because the ng serve command no longer supports --extractCss option

打开package.json.您会发现

{
  "scripts": {
    "start": "ng serve --extract-css" // Please remove the --extract-css
    // ...
  }  
}

start脚本中删除--extract-css.

现在开始

{
  "scripts": {
     "start": "ng serve"
      // ...
  }   
}

现在打开angular.json.在build配置中设置"extractCss": true

Now open angular.json. set "extractCss": true in build configuration

示例:

"build": {
    "architect": {
           "configurations": {
                "extractCss": true,
                  //...
             }
         }
      }
   }

参考: https://github .com/angular/angular-cli/issues/10666#issuecomment-386843570

参考文献2: 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆