Asp.Net Core和Angular部署以错误代码1退出

时间:2018-03-02 16:01:53

标签: c# angular asp.net-core-2.0

所以这是一个有趣的。我已经看到相当多的人试图将Asp.Net Core w / Angular应用程序发布到文件夹,然后退出时出现错误代码2.但是我收到了错误代码1.我似乎无法找到任何可能指向正确方向的东西。这似乎与我在这个项目中从Angular 4升级到5的事实有关。在调试期间,所有内容都可以顺利编译。 我得到的实际错误:

The command "node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js --env.prod" exited with code 1

无法编译后转储的临时文件

3/1/2018 3:23:22 PM
System.AggregateException: One or more errors occurred. --->         System.Exception: Publish failed due to build errors. Check the error list for more details.
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at Microsoft.VisualStudio.Web.Publish.PublishService.VsWebProjectPublish.<>c__DisplayClass40_0.<PublishAsync>b__2()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.ApplicationCapabilities.Publish.ViewModel.ProfileSelector.ViewModel.<RunPublishTaskAsync>d__108.MoveNext()
--->(Inner Exception #0) System.Exception: Publish failed due to build errors. Check the error list for more details.<---

===================

最后我的json.package文件

{
"name": "******",
"private": true,
"version": "0.0.0",
"scripts": {
"test": "karma start ClientApp/test/karma.conf.js"
},
"devDependencies": {
 "@angular/animations": "5.2.6",
 "@angular/cli": "^1.7.1",
 "@angular/common": "5.2.6",
 "@angular/compiler": "5.2.6",
 "@angular/compiler-cli": "5.2.6",
 "@angular/core": "5.2.6",
 "@angular/forms": "5.2.6",
 "@angular/http": "5.2.6",
 "@angular/platform-browser": "5.2.6",
 "@angular/platform-browser-dynamic": "5.2.6",
 "@angular/platform-server": "5.2.6",
 "@angular/router": "5.2.6",
 "@ngtools/webpack": "^1.10.1",
 "@types/chai": "4.1.2",
 "@types/jasmine": "2.8.6",
 "@types/webpack-env": "1.13.5",
 "angular2-router-loader": "0.3.5",
 "angular2-template-loader": "0.6.2",
 "aspnet-prerendering": "^3.0.1",
 "aspnet-webpack": "^2.0.3",
 "awesome-typescript-loader": "3.5.0",
 "bootstrap": "4.0.0",
 "chai": "4.1.2",
 "css": "2.2.1",
 "css-loader": "0.28.10",
 "es6-shim": "0.35.3",
 "event-source-polyfill": "0.0.12",
 "expose-loader": "0.7.4",
 "extract-text-webpack-plugin": "3.0.2",
 "file-loader": "1.1.10",
 "html-loader": "0.5.5",
 "isomorphic-fetch": "2.2.1",
 "jasmine-core": "3.0.0",
 "jquery": "3.3.1",
 "json-loader": "0.5.7",
 "karma": "2.0.0",
 "karma-chai": "0.1.0",
 "karma-chrome-launcher": "2.2.0",
 "karma-cli": "1.0.1",
 "karma-jasmine": "1.1.1",
 "karma-webpack": "2.0.12",
 "popper.js": "^1.12.9",
 "preboot": "6.0.0-beta.3",
 "raw-loader": "0.5.1",
 "reflect-metadata": "0.1.12",
 "rxjs": "5.5.6",
 "style-loader": "0.20.2",
 "to-string-loader": "1.1.5",
 "typescript": "^2.6.2",
 "url-loader": "0.6.2",
 "webpack": "^4.0.1",
 "webpack-hot-middleware": "2.21.0",
 "webpack-merge": "4.1.2",
 "zone.js": "0.8.20"
 }
}

如果您需要更多信息,请随时提出。我很感激任何人对这个问题的帮助。

1 个答案:

答案 0 :(得分:0)

您是否尝试过在控制台上运行失败的命令?

C:\ MySolutionPath&GT; node node_modules / webpack / bin / webpack.js ........

当我这样做时,它实际上在我的打字稿和模板中吐出了一系列错误。我在项目中发现的问题是我的私人财产无法通过我的模板访问。例如:

ERROR in quiz.component.html: Property 'auth' is private and only accessible within class 'QuizComponent'.
ERROR in quiz.component.html: Property 'auth' is private and only accessible within class 'QuizComponent'.

参考:https://www.ryadel.com/en/the-command-node-node_modules-webpack-bin-webpack-js-env-prod-exited-with-code-2-error-fix-angular-node/