我正在尝试使用棱角分明的4.4.6应用程序处理角度素材,但在我尝试导入BrowserAnimationsModule时在浏览器中收到错误消息。
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
imports: [
CommonModule,
HttpModule,
FormsModule,
AngularFontAwesomeModule,
BrowserModule,
BrowserAnimationsModule,
RouterModule.forRoot([
{ path: 'register', component: RegisterComponent },
{ path: 'login', component: LoginComponent },
{ path: 'member-detail/:id', component: MemberDetailComponent },
{ path: 'member-listing', component: MemberListingComponent },
的package.json
"依赖":{ " @ angular / animations":" ^ 4.4.6", " @ angular / cdk":" ^ 2.0.0-beta.12", " @ angular / common":" ^ 4.4.6", " @ angular / compiler":" ^ 4.4.6", " @ angular / compiler-cli":" ^ 4.4.6", " @ angular / core":" ^ 4.4.6", " @ angular / forms":" ^ 4.4.6", " @ angular / http":" ^ 4.4.6", " @ angular / material":" ^ 2.0.0-beta.12", " @ angular / platform-browser":" ^ 4.4.6", " @ angular / platform-browser-dynamic":" ^ 4.4.6", " @ angular / platform-server":" ^ 4.4.6",
浏览器中的错误消息:
处理请求时发生未处理的异常。
NodeInvocationException:未定义文档 ReferenceError:未定义文档 在DefaultDomRenderer2.module.exports.DefaultDomRenderer2.selectRootElement(C:\ Code \ winowio_core \ winowio_core \ Client \ dist \ vendor.js:28722:72) 在BaseAnimationRenderer.selectRootElement(C:\ Code \ winowio_core \ winowio_core \ Client \ dist \ main-server.js:19174:106) 在createElement(C:\ Code \ winowio_core \ winowio_core \ Client \ dist \ vendor.js:20127:23) 在createViewNodes(C:\ Code \ winowio_core \ winowio_core \ Client \ dist \ vendor.js:23093:44) 在createRootView(C:\ Code \ winowio_core \ winowio_core \ Client \ dist \ vendor.js:23022:5) 在Object.createProdRootView [as createRootView](C:\ Code \ winowio_core \ winowio_core \ Client \ dist \ vendor.js:23707:12) 在ComponentFactory_.module.exports.ComponentFactory_.create(C:\ Code \ winowio_core \ winowio_core \ Client \ dist \ vendor.js:20813:46) 在ComponentFactoryBoundToModule.module.exports.ComponentFactoryBoundToModule.create(C:\ Code \ winowio_core \ winowio_core \ Client \ dist \ vendor.js:14230:29) 在ApplicationRef_.module.exports.ApplicationRef_.bootstrap(C:\ Code \ winowio_core \ winowio_core \ Client \ dist \ vendor.js:15719:57) 在C:\ Code \ winowio_core \ winowio_core \ Client \ dist \ vendor.js:15502:81 Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance + d__7.MoveNext()
堆栈查询Cookie标头 NodeInvocationException:未定义文档 ReferenceError:在BaseAnimationRenderer.selectRootElement(C:\ Code \ winowio_core \)的DefaultDomRenderer2.module.exports.DefaultDomRenderer2.selectRootElement(C:\ Code \ winowio_core \ winowio_core \ Client \ dist \ vendor.js:28722:72)中未定义文档winowio_core \ Client \ dist \ main-server.js:19174:106)at createElement(C:\ Code \ winowio_core \ winowio_core \ Client \ dist \ vendor.js:20127:23)at createViewNodes(C:\ Code \ winowio_core \ winowio_core \ Client \ dist \ vendor.js:23093:44)在Object.createProdRootView的createRootView(C:\ Code \ winowio_core \ winowio_core \ Client \ dist \ vendor.js:23022:5)[作为createRootView](C:\ Code \ winowio_core \ winowio_core \ Client \ dist \ vendor.js:23707:12)在ComponentFactory_.module.exports.ComponentFactory_.create(C:\ Code \ winowio_core \ winowio_core \ Client \ dist \ vendor.js:20813:46)在ApplicationRef_.module.exports.ApplicationRef_.b的ComponentFactoryBoundToModule.module.exports.ComponentFactoryBoundToModule.create(C:\ Code \ winowio_core \ winowio_core \ Client \ dist \ vendor.js:14230:29) ootstrap(C:\ Code \ winowio_core \ winowio_core \ Client \ dist \ vendor.js:15719:57)位于C:\ Code \ winowio_core \ winowio_core \ Client \ dist \ vendor.js:15502:81 Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance + d__7.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) System.Runtime.CompilerServices.TaskAwaiter.GetResult() Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance + d__13.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) System.Runtime.CompilerServices.TaskAwaiter.GetResult() Microsoft.AspNetCore.NodeServices.NodeServicesImpl + d__10.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() Microsoft.AspNetCore.NodeServices.NodeServicesImpl + d__10.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) System.Runtime.CompilerServices.TaskAwaiter.GetResult() Microsoft.AspNetCore.NodeServices.NodeServicesImpl + d__10.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) System.Runtime.CompilerServices.TaskAwaiter.GetResult() Microsoft.AspNetCore.SpaServices.Prerendering.PrerenderTagHelper + d__29.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner + d__0.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) Index.cshtml中的AspNetCore._Views_Home_Index_cshtml + d__12.MoveNext() + ViewData ["标题"] ="主页&#34 ;; System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) Microsoft.AspNetCore.Mvc.Razor.RazorView + d__16.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) Microsoft.AspNetCore.Mvc.Razor.RazorView + d__15.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) System.Runtime.CompilerServices.TaskAwaiter.GetResult() Microsoft.AspNetCore.Mvc.Razor.RazorView + d__14.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor + d__22.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor + d__21.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) Microsoft.AspNetCore.Mvc.ViewResult + d__26.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker + d__19.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker + d__24.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResultExecutedContext context) Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(ref state next,ref Scope scope,ref object state,ref bool isCompleted) Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker + d__22.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context) Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(ref state next,ref Scope scope,ref object state,ref bool isCompleted) Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker + d__17.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker + d__15.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) Microsoft.AspNetCore.Builder.RouterMiddleware + d__4.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) Microsoft.AspNetCore.Authentication.AuthenticationMiddleware + d__6.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) Microsoft.AspNetCore.SpaServices.Webpack.ConditionalProxyMiddleware + d__6.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) Microsoft.AspNetCore.SpaServices.Webpack.ConditionalProxyMiddleware + d__6.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware + d__7.MoveNext()
答案 0 :(得分:2)
好的,我遇到了同样的问题。
转到Views-> Home-> Index.cshtml并更改
<app asp-prerender-module="ClientApp/dist/main-server">Loading...</app>
为:
<app asp-ng2-prerender-module="ClientApp/dist/main-server">Loading...</app>
这是另一个与stackoverflow相关的问题。