Aspnetcore-angular-universal: Exception: Call to Node module failed with error: reflect-metadata shim is required when using class decorators

Created on 17 Nov 2016  路  4Comments  路  Source: TrilonIO/aspnetcore-angular-universal

Hello,

Get an error:

screen shot 2016-11-17 at 7 12 54 pm

but It's ok to use webpack build:
screen shot 2016-11-17 at 7 12 49 pm

The project's npm dependices restoring output:
screen shot 2016-11-17 at 7 21 51 pm

Environment
npm -v
3.8.2

node -v
v4.4.1

Exception Stack
Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ViewResultExecutor:Information: Executing ViewResult, running view at path /Views/Home/Index.cshtml.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Users\darkl.nuget\packages\Microsoft.AspNetCore.WebUtilities\1.0.0\lib\netstandard1.3\Microsoft.AspNetCore.WebUtilities.dll'. Loading disabled by Include/Exclude setting.
Microsoft.Extensions.DependencyInjection.DataProtectionServices:Information: User profile is available. Using 'C:\Users\darkl\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.0.1\System.Reflection.Emit.dll'. Loading disabled by Include/Exclude setting.
Microsoft.AspNetCore.NodeServices:Information: Node will restart because file changed: F:\git\aspnetcore-angular2-universal\wwwroot\dist\main.js
Microsoft.AspNetCore.NodeServices:Information: webpack built 396559ce6e3756fbe2a7 in 9638ms
Microsoft.AspNetCore.NodeServices:Information: [default] Checking started in a separate process...
Microsoft.AspNetCore.NodeServices:Information: [default] Ok, 5.798 sec.
Exception thrown: 'System.ArgumentNullException' in System.Private.CoreLib.ni.dll
Exception thrown: 'System.Exception' in Microsoft.AspNetCore.NodeServices.dll
Exception thrown: 'System.Exception' in System.Private.CoreLib.ni.dll
Exception thrown: 'System.Exception' in System.Private.CoreLib.ni.dll
Exception thrown: 'System.Exception' in System.Private.CoreLib.ni.dll
Exception thrown: 'System.Exception' in System.Private.CoreLib.ni.dll
Exception thrown: 'System.Exception' in System.Private.CoreLib.ni.dll
Exception thrown: 'System.Exception' in System.Private.CoreLib.ni.dll
Exception thrown: 'System.Exception' in System.Private.CoreLib.ni.dll
Exception thrown: 'System.Exception' in System.Private.CoreLib.ni.dll
Exception thrown: 'System.Exception' in System.Private.CoreLib.ni.dll
Exception thrown: 'System.Exception' in System.Private.CoreLib.ni.dll
Exception thrown: 'System.Exception' in System.Private.CoreLib.ni.dll
Exception thrown: 'System.Exception' in Microsoft.AspNetCore.Mvc.Core.dll
Exception thrown: 'System.Exception' in System.Private.CoreLib.ni.dll
Exception thrown: 'System.Exception' in Microsoft.AspNetCore.Mvc.Core.dll
Exception thrown: 'System.Exception' in System.Private.CoreLib.ni.dll
Exception thrown: 'System.Exception' in System.Private.CoreLib.ni.dll
Exception thrown: 'System.Exception' in System.Private.CoreLib.ni.dll
Exception thrown: 'System.Exception' in System.Private.CoreLib.ni.dll
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.0.1\System.Diagnostics.StackTrace.dll'. Loading disabled by Include/Exclude setting.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.0.1\System.IO.MemoryMappedFiles.dll'. Loading disabled by Include/Exclude setting.
Exception thrown: 'System.IO.FileNotFoundException' in System.Private.CoreLib.ni.dll
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.0.1\System.IO.UnmanagedMemoryStream.dll'. Loading disabled by Include/Exclude setting.
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware:Error: An unhandled exception has occurred while executing the request

System.Exception: Call to Node module failed with error: reflect-metadata shim is required when using class decorators
at Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance.d__71.MoveNext() --- 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 System.Runtime.CompilerServices.TaskAwaiter1.GetResult()
at Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance.d__131.MoveNext() --- 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 System.Runtime.CompilerServices.TaskAwaiter1.GetResult()
at Microsoft.AspNetCore.NodeServices.NodeServicesImpl.d__101.MoveNext() --- 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 System.Runtime.CompilerServices.TaskAwaiter1.GetResult()
at Microsoft.AspNetCore.SpaServices.Prerendering.PrerenderTagHelper.d__33.MoveNext()
--- 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.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner.d__0.MoveNext()
--- 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 System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at AspNetCore._Views_Home_Index_cshtml.d__32.MoveNext() in /Views/Home/Index.cshtml:line 2
--- 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.AspNetCore.Mvc.Razor.RazorView.d__14.MoveNext()
--- 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.AspNetCore.Mvc.Razor.RazorView.d__13.MoveNext()
--- 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.AspNetCore.Mvc.ViewFeatures.ViewExecutor.d__18.MoveNext()
--- 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.AspNetCore.Mvc.ViewResult.d__26.MoveNext()
--- 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.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__32.MoveNext()
--- 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.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__31.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__29.MoveNext()
--- 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.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__23.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__18.MoveNext()
--- 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.AspNetCore.Builder.RouterMiddleware.d__4.MoveNext()
--- 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.AspNetCore.Builder.Extensions.MapMiddleware.d__3.MoveNext()
--- 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 System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at Microsoft.AspNetCore.SpaServices.Webpack.ConditionalProxyMiddleware.d__5.MoveNext()
--- 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.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.d__6.MoveNext()
Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request finished in 17725.885ms 500 text/html; charset=utf-8

All 4 comments

@darklx Hey there, so this is a fairly common install issue that stems from an older version of NPM. You'll need npm 3.*+. You can do node --version && npm --v to see what you currently have.

If you go and install the latest Node, 7.1, you should be able to install everything over again without any problems. Just make sure to wipe out your node_modules beforehand.

Thanks for reminding me I'll make sure to add the strictEngine warnings to help prevent things like this!

Hope that helps, let me know!

When I upgrade to node 7.0.0 It's OK,thank you !!!

Glad to hear it. Keep an eye out for more updates to come. Doing some general clean-up, and trying to get some more real-world examples in here as soon as I can.

Cool !!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

peterdobson picture peterdobson  路  4Comments

MapleYe picture MapleYe  路  3Comments

peterdobson picture peterdobson  路  3Comments

naveedahmed1 picture naveedahmed1  路  3Comments

johnwpowell picture johnwpowell  路  4Comments