[英]Angular : Unable to build application
I am working on an angular6 app using asp.net core 2.1. 我正在使用asp.net core 2.1开发angular6应用程序。
On building the project using ng build --prod
I am getting below errors but if I run the project its working perfectly : 在使用
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)
在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)
在新的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)
在新的编译器上(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)
在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)
在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)
在Object.pitch(D:\\ New Loc \\ Angular6_Core_2 \\ WebApplication1 \\ WebApplication1 \\ ClientApp \\ node_modules \\ mini-css-extract-plugin \\ dist \\ loader.js:78:43)
Edit : 编辑:
Package.json : 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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.