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

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

问题描述

我已经从 cli 搭建了 AspNetCore Angular 6.0 SPA 模板,然后相应地安装了 npm 包.

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

但是,当我尝试运行项目 dotnet run 时,它不会启动,而是提示错误.我截取了一个截图供您参考.我不确定它是否与 angular.Json 文件或其他有关!!!任何想法..

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配置

示例:

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

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

参考文献 2: http://www.talkingdotnet.com/upgrade-angular-5-app-angular-6-visual-studio-2017/

这篇关于AspNetCore Angular 6.0 SPA 模板中的未知选项 --extractCss的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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