Angular 角度:无法生成应用程序

Angular 角度:无法生成应用程序,angular,typescript,webpack,angular6,asp.net-core-2.1,Angular,Typescript,Webpack,Angular6,Asp.net Core 2.1,我正在使用asp.net core 2.1开发angular6应用程序 使用ng build--prod构建项目时,我会遇到以下错误,但如果我运行项目,它会正常工作: 模块生成中的错误失败:TypeError:无法读取属性 未定义的“替换” 在normalizeBackSlashDirection(D:\New Loc\Angular6\u Core\u 2\WebApplication1\WebApplication1\ClientApp\node\u modules\webpack\lib

我正在使用asp.net core 2.1开发angular6应用程序

使用
ng build--prod
构建项目时,我会遇到以下错误,但如果我运行项目,它会正常工作:

模块生成中的错误失败:TypeError:无法读取属性 未定义的“替换”

  • 在normalizeBackSlashDirection(D:\New Loc\Angular6\u Core\u 2\WebApplication1\WebApplication1\ClientApp\node\u modules\webpack\lib\RequestShortener.js:15:17)

  • 在新的RequestShortener(D:\new Loc\Angular6\u Core\u 2\WebApplication1\WebApplication1\ClientApp\node\u modules\webpack\lib\RequestShortener.js:25:15)

  • 在新编译器上(D:\new Loc\Angular6\u Core\u 2\WebApplication1\WebApplication1\ClientApp\node\u modules\webpack\lib\Compiler.js:136:27)
  • 在Compiler.createChildCompiler(D:\New Loc\Angular6\u Core\u 2\WebApplication1\WebApplication1\ClientApp\node\u modules\webpack\lib\Compiler.js:371:25)
  • 在Compilation.createChildCompiler(D:\New Loc\Angular6\u Core\u 2\WebApplication1\WebApplication1\ClientApp\node\u modules\webpack\lib\Compilation.js:1851:24)
  • 在Object.pitch(D:\New Loc\Angular6\u Core\u 2\WebApplication1\WebApplication1\ClientApp\node\u modules\mini css extract plugin\dist\loader.js:78:43)
编辑:

Package.json:

{
  "name": "WebApplication1",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "build:ssr": "npm run build -- --app=ssr --output-hashing=media",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^6.0.9",
    "@angular/common": "^6.0.9",
    "@angular/compiler": "^6.0.9",
    "@angular/core": "^6.0.9",
    "@angular/forms": "^6.0.9",
    "@angular/http": "^6.0.9",
    "@angular/platform-browser": "^6.0.9",
    "@angular/platform-browser-dynamic": "^6.0.9",
    "@angular/platform-server": "^6.0.9",
    "@angular/router": "^6.0.9",
    "@aspnet/signalr": "^1.0.2",
    "@nguniversal/module-map-ngfactory-loader": "^5.0.0-beta.5",
    "@swimlane/ngx-charts": "^9.0.0",
    "@swimlane/ngx-datatable": "^13.0.1",
    "aspnet-prerendering": "^3.0.1",
    "bootstrap": "^3.3.7",
    "core-js": "^2.4.1",
    "jquery": "^3.3.1",
    "ngx-loading": "^1.0.14",
    "ngx-toastr": "^8.8.0",
    "primeng": "^6.0.0",
    "rxjs": "^6.2.2",
    "stacktrace-js": "^2.0.0",
    "sweetalert2": "^7.24.4",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angular/cli": "^6.0.8",
    "@angular/compiler-cli": "^6.0.9",
    "@angular/language-service": "^6.0.9",
    "@types/jasmine": "~2.8.3",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "codelyzer": "^4.0.1",
    "jasmine-core": "~2.8.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~2.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~4.1.0",
    "tslint": "~5.9.1",
    "typescript": "~2.7.2",
    "@angular-devkit/build-angular": "~0.6.8"
  },
  "optionalDependencies": {
    "node-sass": "^4.9.0"
  }
}

试试这个:

ng build --env=prod

试试这个:

ng build --env=prod

您应该在一个html模板中有一个字段
replace
的绑定,并且该属性不在组件中。不,它不在任何页面中,我用“replace”搜索,可能您正在链接一个不存在的css或其他样式的文件运行
npm I
,然后重试again@LahiruChandima这是一个网页问题,如跟踪中所述。因此,这是一个库问题,而不是项目问题。您应该在一个html模板中为字段
replace
设置绑定,并且该属性不在组件中。不,它不在任何页面中,我用“replace”搜索可能您正在链接一个不存在的css或其他样式的文件运行
npmi
,然后重试again@LahiruChandima这是一个网页问题,如跟踪中所述。所以是库问题,而不是项目问题。未知选项:'--env'Angular 6是
--configuration=prod
,但可以缩短为
--prod
未知选项:'--env'Angular 6是
--configuration=prod
,但可以缩短为
--prod