Repository navigation
Call to Node module failed with error: '...\ClientApp\dist\main-server' #363
Description
Activity
@SteveSandersonMS This is why I changed those names, seems webpack was changed but these weren't renamed?
@scy0846 Have you checked that
main-server.js/main-client.jsreally exist at those locations on disk? If they aren't, have you really runwebpack --config webpack.config.vendor.jsandwebpackfrom the project root dir (i.e.,C:\Users\tmitchell\Downloads\JavaScriptServices-dev\JavaScriptServices-dev\templates\ReactReduxSpa\)?@MarkPieszak I'm not sure what you mean. Can you be specific about what you think has changed and why exactly it's a problem? My best guess is that you're referring to this line from
webpack.config.jsin the ReactReduxSpa template:entry: { 'main-client': './ClientApp/boot-client.tsx' }Are you concerned that the bundle output name
main-clientisn't the same as the entry point fileboot-client.tsx? There's no reason why they should be the same -boot-client.tsxis the name of the entry point file, which references many other files, andmain-clientis the name for the complete bundle that includes the whole set of dependencies.Reacted by Josh Darnell@SteveSandersonMS You're right, this must of been something I changed unknowingly on my end, apologies! Also I reverted the naming conventions back to the
boot-in the TS2 PR.CaffeinatedFunctionality commented
on Oct 10, 2016 AuthorMore actionsmain-server.js/main-client.jsdo not exist. When I try to runwebpackI get this errorλ webpack C:\TFS\VPOMS.React\webpack.config.js:10 var sharedConfig = () => ({ ^ SyntaxError: Unexpected token ) at exports.runInThisContext (vm.js:73:16) at Module._compile (module.js:443:25) at Object.Module._extensions..js (module.js:478:10) at Module.load (module.js:355:32) at Function.Module._load (module.js:310:12) at Module.require (module.js:365:17) at require (module.js:384:17) at module.exports (C:\Users\tmitchell\AppData\Roaming\npm\node_modules\webpack\bin\convert-argv.js:80:13) at Object.<anonymous> (C:\Users\tmitchell\AppData\Roaming\npm\node_modules\webpack\bin\webpack.js:39:40) at Module._compile (module.js:460:26)@scy0846 Thanks for the info.
You're running an old version of Node.js that doesn't support arrow functions. For now at least, you'll need Node 4.x or later.
Reacted by Mark PieszakCaffeinatedFunctionality commented
on Oct 10, 2016 AuthorMore actionsActually I'm running 6.7.0
@scy0846 I'm not sure how that can be right. Node 6.7.0 does have support for arrow functions, but the error message you've posted is exactly what old versions of Node (0.x) report because they don't support arrow functions. If you run
node -vin the same console window that you got the error from runningwebpack, does it really report 6.7.0?CaffeinatedFunctionality commented
on Oct 10, 2016 AuthorMore actionsI think my last post was an issue with my work machine. Windows says it's 6.7.0, but my terminal says 0.12.2. I think I've got a bigger issue to run down, but it's not your program. Sorry about that. Thank you. I'm going to switch to my personal machine which does show 6.7.0 and see if I can get it to run correctly on that.
No problem - thanks for confirming!
CaffeinatedFunctionality commented
on Oct 10, 2016 AuthorMore actionsyep. Looks like that part was a config mistake. It was using my 32 bit node file. Anyways I'm still getting the original issue with
main-server.jsnot being there.C:\TFS\VPOMS.React λ node -v v4.6.0 C:\TFS\VPOMS.React λ webpack --config webpack.config.vendor.js Hash: b81f44abad40f2426bcb Version: webpack 1.13.2 Time: 4000ms Asset Size Chunks Chunk Names 89889688147bd7575d6327160d64e760.svg 109 kB [emitted] vendor.js 1.59 MB 0 [emitted] vendor vendor.css 315 kB 0 [emitted] vendor [0] dll vendor 12 bytes {0} [built] + 335 hidden modules Child extract-text-webpack-plugin: + 7 hidden modules C:\TFS\VPOMS.React λ dotnet restore log : Restoring packages for C:\TFS\VPOMS.React\project.json... log : Restoring packages for tool 'Microsoft.AspNetCore.Razor.Tools' in C:\TFS\VPOMS.React\project.json... log : Restoring packages for tool 'Microsoft.AspNetCore.Server.IISIntegration.Tools' in C:\TFS\VPOMS.React\project.json... log : Restoring packages for tool 'Microsoft.DotNet.Watcher.Tools' in C:\TFS\VPOMS.React\project.json... log : Lock file has not changed. Skipping lock file write. Path: C:\TFS\VPOMS.React\project.lock.json log : Restore completed in 2373ms for C:\TFS\VPOMS.React\project.json. C:\TFS\VPOMS.React λ dotnet run Project VPOMS.React (.NETCoreApp,Version=v1.0) was previously compiled. Skipping compilation. Hosting environment: Production Content root path: C:\TFS\VPOMS.React Now listening on: http://localhost:5000 Application started. Press Ctrl+C to shut down. info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1] Request starting HTTP/1.1 GET http://localhost:5000/ info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1] Executing action method VpomsReact.Controllers.HomeController.Index (VPOMS.React) with arguments () - ModelState is Valid info: Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ViewResultExecutor[1] Executing ViewResult, running view at path /Views/Home/Index.cshtml. info: Microsoft.Extensions.DependencyInjection.DataProtectionServices[0] User profile is available. Using 'C:\Users\tmitchell\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest. fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[0] An unhandled exception has occurred: Call to Node module failed with error: Error: Cannot find module 'C:\TFS\VPOMS.React\ClientApp\dist\main-server' at Function.Module._resolveFilename (module.js:325:15) at Function.Module._load (module.js:276:25) at Module.require (module.js:353:17) at require (internal/module.js:12:17) at findBootModule (C:\TFS\VPOMS.React\node_modules\aspnet-prerendering\Prerendering.js:98:24) at findBootFunc (C:\TFS\VPOMS.React\node_modules\aspnet-prerendering\Prerendering.js:103:5) at renderToString (C:\TFS\VPOMS.React\node_modules\aspnet-prerendering\Prerendering.js:10:5) at module.exports.renderToString (C:\Users\tmitchell\AppData\Local\Temp\tmp33E6.tmp:19:46) at C:\Users\tmitchell\AppData\Local\Temp\tmp33F7.tmp:113:19 at IncomingMessage.<anonymous> (C:\Users\tmitchell\AppData\Local\Temp\tmp33F7.tmp:132:38) System.Exception: Call to Node module failed with error: Error: Cannot find module 'C:\TFS\VPOMS.React\ClientApp\dist\main-server' at Function.Module._resolveFilename (module.js:325:15) at Function.Module._load (module.js:276:25) at Module.require (module.js:353:17) at require (internal/module.js:12:17) at findBootModule (C:\TFS\VPOMS.React\node_modules\aspnet-prerendering\Prerendering.js:98:24) at findBootFunc (C:\TFS\VPOMS.React\node_modules\aspnet-prerendering\Prerendering.js:103:5) at renderToString (C:\TFS\VPOMS.React\node_modules\aspnet-prerendering\Prerendering.js:10:5) at module.exports.renderToString (C:\Users\tmitchell\AppData\Local\Temp\tmp33E6.tmp:19:46) at C:\Users\tmitchell\AppData\Local\Temp\tmp33F7.tmp:113:19 at IncomingMessage.<anonymous> (C:\Users\tmitchell\AppData\Local\Temp\tmp33F7.tmp:132:38) at Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance.<InvokeExportAsync>d__7`1.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`1.GetResult() at Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance.<InvokeExportAsync>d__13`1.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`1.GetResult() at Microsoft.AspNetCore.NodeServices.NodeServicesImpl.<InvokeExportWithPossibleRetryAsync>d__10`1.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`1.GetResult() at Microsoft.AspNetCore.SpaServices.Prerendering.PrerenderTagHelper.<ProcessAsync>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.<RunAsync>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 AspNetCore._Views_Home_Index_cshtml.<ExecuteAsync>d__31.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.<RenderPageAsync>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.<RenderAsync>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.<ExecuteAsync>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.<ExecuteResultAsync>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.<InvokeResultAsync>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.<InvokeResultFilterAsync>d__31.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeAllResultFiltersAsync>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.<InvokeResourceFilterAsync>d__23.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeAsync>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.<Invoke>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.Diagnostics.ExceptionHandlerMiddleware.<Invoke>d__6.MoveNext() info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1] Executing action method VpomsReact.Controllers.HomeController.Error (VPOMS.React) with arguments () - ModelState is Valid info: Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ViewResultExecutor[1] Executing ViewResult, running view at path /Views/Shared/Error.cshtml. info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2] Executed action VpomsReact.Controllers.HomeController.Error (VPOMS.React) in 260.5619ms info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2] Request finished in 4186.8511ms 500 text/html; charset=utf-8 info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1] Request starting HTTP/1.1 GET http://localhost:5000/dist/vendor.css?v=UnfXt7q2sYmIi7gncWunPd09y2XWaIg2OVQ3lFs0GSw info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1] Request starting HTTP/1.1 GET http://localhost:5000/dist/vendor.js?v=6DCMCxQkf_Wyy_9r3BN6K7-MRTIu8z7ltszheXLSfCA info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1] Request starting HTTP/1.1 GET http://localhost:5000/dist/site.css info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2] Request finished in 46.5364ms 404 info: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[2] Sending file. Request path: '/dist/vendor.css'. Physical path: 'C:\TFS\VPOMS.React\wwwroot\dist\vendor.css' info: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[2] Sending file. Request path: '/dist/vendor.js'. Physical path: 'C:\TFS\VPOMS.React\wwwroot\dist\vendor.js' info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2] Request finished in 87.4114ms 200 text/css info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2] Request finished in 173.6216ms 200 application/javascript info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1] Request starting HTTP/1.1 GET http://localhost:5000/favicon.ico info: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[2] Sending file. Request path: '/favicon.ico'. Physical path: 'C:\TFS\VPOMS.React\wwwroot\favicon.ico' info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2] Request finished in 4.7746ms 200 image/x-iconYou still haven't run
webpack(you only ranwebpack --config webpack.config.vendor.js).Reacted by 9swampy, tonven, Daniel Sirz and marinavCaffeinatedFunctionality commented
on Oct 10, 2016 AuthorMore actionsThank you. You are correct. Sorry about that. I was trying to go by the instructions in the blog and missed that I needed to run that. I had to install
webpack-node-externalsfirst. It works. Thank you for your help.THANK YOU, @SteveSanderson !
I'm not sure at this time what's causing it. I'm going to do some more research and figure it out.
I'm using DotNetCore.1.0.1-VS2015Tools.Preview2.0.2.
I have the latest Node and npm installed.
Issue is line 5 of Views\Home\index.cshtml
Removing the
asp-prerender-module="ClientApp/dist/main-server"gives the following error in the js console.this means webpack is not bundling correctly, which leads me to conclude this is an issue with the webpack config. Still researching.