gpt4 book ai didi

Angular : Unable to build application

转载 作者:搜寻专家 更新时间:2023-10-30 22:03:20 26 4
gpt4 key购买 nike

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

在使用 ng build --prod 构建项目时,我遇到了以下错误,但是如果我运行该项目,它会完美运行:

ERROR in Module build failed: TypeError: Cannot read property 'replace' of undefined

  • at normalizeBackSlashDirection (D:\New Loc\Angular6_Core_2\WebApplication1\WebApplication1\ClientApp\node_modules\webpack\lib\RequestShortener.js:15:17)

  • at new RequestShortener (D:\New Loc\Angular6_Core_2\WebApplication1\WebApplication1\ClientApp\node_modules\webpack\lib\RequestShortener.js:25:15)

  • at new Compiler (D:\New Loc\Angular6_Core_2\WebApplication1\WebApplication1\ClientApp\node_modules\webpack\lib\Compiler.js:136:27)
  • at Compiler.createChildCompiler (D:\New Loc\Angular6_Core_2\WebApplication1\WebApplication1\ClientApp\node_modules\webpack\lib\Compiler.js:371:25)
  • at Compilation.createChildCompiler (D:\New Loc\Angular6_Core_2\WebApplication1\WebApplication1\ClientApp\node_modules\webpack\lib\Compilation.js:1851:24)
  • at Object.pitch (D:\New Loc\Angular6_Core_2\WebApplication1\WebApplication1\ClientApp\node_modules\mini-css-extract-plugin\dist\loader.js:78:43)

编辑:

包.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

关于 Angular : Unable to build application,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51497631/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com