3

I have developed an ASP.NET Core 2.0 App with Angular 4 that I have tried to update to Angular 5.

To do the update I have followed this tutorial, Upgrade Angular 4 app to Angular 5 with Visual Studio 2017.

But when I run the app using node I get the following message:

info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
      User profile is available. Using 'C:\Users\Uic18.IC.000\AppData\Local\ASP.
NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at
rest.
Hosting environment: Development
Content root path: D:\Desarrollo\MyApp\AngularWebApplic
ation\AngularWebApplication
Now listening on: http://localhost:50356
Application started. Press Ctrl+C to shut down.
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:50356/
info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1]
      Executing action method AngularWebApplication.Controllers.HomeController.I
ndex (AngularWebApplication) with arguments ((null)) - ModelState is Valid
info: Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ViewResultExecutor[1]
      Executing ViewResult, running view at path /Views/Home/Index.cshtml.
info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]
      Executed action AngularWebApplication.Controllers.HomeController.Index (An
gularWebApplication) in 3819.9801ms
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
      Request finished in 4181.4943ms 200 text/html; charset=utf-8
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:50356/dist/main-client.js?v
=8SjbzGJ0XAUj8-zoVkv-_b_lOUJstsV6wmYaawCZjd4
info: Microsoft.AspNetCore.NodeServices[0]
      webpack built 87cdc734d642ca666961 in 10958ms
fail: Microsoft.AspNetCore.NodeServices[0]
      Hash: 87cdc734d642ca666961
      Version: webpack 3.11.0
      Time: 10958ms
                   Asset     Size  Chunks                    Chunk Names
          main-client.js  4.12 MB       0  [emitted]  [big]  main-client
      main-client.js.map  5.07 MB       0  [emitted]         main-client
         [0] ./node_modules/@angular/core/esm5/core.js 628 kB {0} [built]
        [79] multi event-source-polyfill webpack-hot-middleware/client?path=__we
bpack_hmr&dynamicPublicPath=true ./ClientApp/boot.browser.ts 52 bytes {0} [built
]
        [80] ./node_modules/event-source-polyfill/src/eventsource.js 21.4 kB {0}
 [built]
        [81] (webpack)-hot-middleware/client.js?path=__webpack_hmr&dynamicPublic
Path=true 7.35 kB {0} [built]
        [82] (webpack)/buildin/module.js 517 bytes {0} [built]
        [83] ./node_modules/querystring-es3/index.js 127 bytes {0} [built]
        [86] ./node_modules/strip-ansi/index.js 161 bytes {0} [built]
        [88] (webpack)-hot-middleware/client-overlay.js 2.21 kB {0} [built]
        [93] (webpack)-hot-middleware/process-update.js 4.33 kB {0} [built]
        [94] ./ClientApp/boot.browser.ts 1.01 kB {0} [built]
        [95] ./ClientApp/polyfills.ts 2.54 kB {0} [built]
       [148] ./node_modules/reflect-metadata/Reflect.js 52.3 kB {0} [built]
       [150] ./node_modules/bootstrap/dist/js/bootstrap.js 115 kB {0} [built]
       [156] ./node_modules/@angular/platform-browser-dynamic/esm5/platform-brow
ser-dynamic.js 24.8 kB {0} [built]
       [158] ./ClientApp/app/app.module.browser.ts 1.49 kB {0} [built]
          + 246 hidden modules

      WARNING in ./node_modules/@angular/core/esm5/core.js
      6558:15-36 Critical dependency: the request of a dependency is an expressi
on
       @ ./node_modules/@angular/core/esm5/core.js
       @ ./ClientApp/boot.browser.ts
       @ multi event-source-polyfill webpack-hot-middleware/client?path=__webpac
k_hmr&dynamicPublicPath=true ./ClientApp/boot.browser.ts

      WARNING in ./node_modules/@angular/core/esm5/core.js
      6578:15-102 Critical dependency: the request of a dependency is an express
ion
       @ ./node_modules/@angular/core/esm5/core.js
       @ ./ClientApp/boot.browser.ts
       @ multi event-source-polyfill webpack-hot-middleware/client?path=__webpac
k_hmr&dynamicPublicPath=true ./ClientApp/boot.browser.ts
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
      Request finished in 4074.9028ms 200 application/javascript; charset=UTF-8
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:50356/dist/__webpack_hmr

And I only see in the browser a text saying: Loading...

There is a message fail: Microsoft.AspNetCore.NodeServices[0] but nothing else.

If I rollback the change in Views/Home/Index.cshtml file from <app>Loading...</app> to <app asp-prerender-module="ClientApp/dist/main-server">Loading...</app> I get this another error:

NodeInvocationException: No provider for PlatformRef!
Error: No provider for PlatformRef!
at Error (native)

To solve it I have followed this SO Answer without success.

Any idea about how to solve this problem?

VansFannel
  • 45,055
  • 107
  • 359
  • 626
  • With that SO answer, I came out of that situation `npm install -g webpack@latest` and `webpack --config webpack.config.vendor.js` initially page may not be load again try to refresh then it works fine. – k11k2 Mar 01 '18 at 05:07
  • @k11k2 Thanks, but in my case, it doesn't work. – VansFannel Mar 02 '18 at 07:22
  • I face the same issue, have you found any solution to make it work? – Nguyen Tran Sep 07 '18 at 06:25
  • @NguyenTran No, but I'm going to try to create a new empty project with Visual Studio for Angular 5 and then move my Apps and .NET Core code to it. – VansFannel Sep 07 '18 at 08:30
  • @VansFannel Thanks, I'm using webpack watch at the moment as an alternative solution. – Nguyen Tran Sep 07 '18 at 11:17

0 Answers0