AspNetCore Angular 6.0 SPA模板中的未知选项--extractCss [英] Unknown option --extractCss in AspNetCore Angular 6.0 SPA Template
问题描述
我从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: 查看全文