Angular template error on dotnet publish #300

Closed
opened 2025-08-09 17:15:46 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @phildaniels on 12/1/2017

When attempting to publish my application made through the dotnet core spa template, I get this error:

C:\App\UserInterface\Web>dotnet publish
Microsoft (R) Build Engine version 15.4.8.50001 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  UserInterface.Web.Angular -> C:\App\UserInterface\Web\bin\Debug\netcoreapp2.0\UserInterface.Web.Angular.dll
  npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules\fsevents):
  npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

  added 116 packages in 16.457s
  Hash: 8251d31c988b9938d48bef55289a61c9dd0f3dc4
  Version: webpack 2.5.1
  Child
      Hash: 8251d31c988b9938d48b
      Time: 21285ms
                                     Asset     Size  Chunks                    Chunk Names
      89889688147bd7575d6327160d64e760.svg   109 kB          [emitted]
                                 vendor.js  1.34 MB       0  [emitted]  [big]  vendor
                                vendor.css   289 kB       0  [emitted]  [big]  vendor

      WARNING in ./~/@angular/core/@angular/core.es5.js
      5704:15-36 Critical dependency: the request of a dependency is an expression

      WARNING in ./~/@angular/core/@angular/core.es5.js
      5720:15-102 Critical dependency: the request of a dependency is an expression
  Child
      Hash: ef55289a61c9dd0f3dc4
      Time: 9287ms
                                     Asset     Size  Chunks                    Chunk Names
      89889688147bd7575d6327160d64e760.svg   109 kB          [emitted]
                                 vendor.js  3.82 MB       0  [emitted]  [big]  vendor
  Hash: 2f8d9d24468c8749d1985f6297459713ae759ea7
  Version: webpack 2.5.1
  Child
      Hash: 2f8d9d24468c8749d198
      Time: 10095ms
                                     Asset     Size  Chunks             Chunk Names
      0024f382a52a2ba9f1a59cc50f8b0e57.png   176 kB          [emitted]
      08a95bcaaa7c8cb522940099a480652f.png  48.4 kB          [emitted]
                            main-client.js     1 kB       0  [emitted]  main-client

      ERROR in ./ClientApp/boot.browser.ts
      Module parse failed: C:\App\UserInterface\Web\ClientApp\boot.browser.ts Unexpected token (14:19)
      You may need an appropriate loader to handle this file type.
      |         const oldRootElem = document.querySelector('app');
      |         const newRootElem = document.createElement('app');
      |         oldRootElem!.parentNode!.insertBefore(newRootElem, oldRootElem);
      |         modulePromise.then(appModule => appModule.destroy());
      |     });
      Child ClientApp\app\components\app\app.component.css:
                                         Asset     Size  Chunks             Chunk Names
          0024f382a52a2ba9f1a59cc50f8b0e57.png   176 kB          [emitted]
          08a95bcaaa7c8cb522940099a480652f.png  48.4 kB          [emitted]
  Child
      Hash: 5f6297459713ae759ea7
      Time: 10079ms
                                     Asset     Size  Chunks             Chunk Names
      0024f382a52a2ba9f1a59cc50f8b0e57.png   176 kB          [emitted]
      08a95bcaaa7c8cb522940099a480652f.png  48.4 kB          [emitted]
                            main-server.js  6.79 kB       0  [emitted]  main-server

      ERROR in ./ClientApp/boot.server.ts
      Module parse failed: C:\App\UserInterface\Web\ClientApp\boot.server.ts Unexpected token (20:20)
      You may need an appropriate loader to handle this file type.
      |
      |     return platformDynamicServer(providers).bootstrapModule(AppModule).then(moduleRef => {
      |         const appRef: ApplicationRef = moduleRef.injector.get(ApplicationRef);
      |         const state = moduleRef.injector.get(PlatformState);
      |         const zone = moduleRef.injector.get(NgZone);
      Child ClientApp\app\components\app\app.component.css:
                                         Asset     Size  Chunks             Chunk Names
          0024f382a52a2ba9f1a59cc50f8b0e57.png   176 kB          [emitted]
          08a95bcaaa7c8cb522940099a480652f.png  48.4 kB          [emitted]
C:\App\UserInterface\Web\UserInterface.Web.Angular.csproj(83,5): error MSB3073: The command "node node_modules/webpack/bin/webpack.js --env.prod" exited with code 2.

Running the error command like this causes no issues:

node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js --env.prod

Suggestions on how to get this to publish?

*Originally created by @phildaniels on 12/1/2017* When attempting to publish my application made through the dotnet core spa template, I get this error: ``` C:\App\UserInterface\Web>dotnet publish Microsoft (R) Build Engine version 15.4.8.50001 for .NET Core Copyright (C) Microsoft Corporation. All rights reserved. UserInterface.Web.Angular -> C:\App\UserInterface\Web\bin\Debug\netcoreapp2.0\UserInterface.Web.Angular.dll npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) added 116 packages in 16.457s Hash: 8251d31c988b9938d48bef55289a61c9dd0f3dc4 Version: webpack 2.5.1 Child Hash: 8251d31c988b9938d48b Time: 21285ms Asset Size Chunks Chunk Names 89889688147bd7575d6327160d64e760.svg 109 kB [emitted] vendor.js 1.34 MB 0 [emitted] [big] vendor vendor.css 289 kB 0 [emitted] [big] vendor WARNING in ./~/@angular/core/@angular/core.es5.js 5704:15-36 Critical dependency: the request of a dependency is an expression WARNING in ./~/@angular/core/@angular/core.es5.js 5720:15-102 Critical dependency: the request of a dependency is an expression Child Hash: ef55289a61c9dd0f3dc4 Time: 9287ms Asset Size Chunks Chunk Names 89889688147bd7575d6327160d64e760.svg 109 kB [emitted] vendor.js 3.82 MB 0 [emitted] [big] vendor Hash: 2f8d9d24468c8749d1985f6297459713ae759ea7 Version: webpack 2.5.1 Child Hash: 2f8d9d24468c8749d198 Time: 10095ms Asset Size Chunks Chunk Names 0024f382a52a2ba9f1a59cc50f8b0e57.png 176 kB [emitted] 08a95bcaaa7c8cb522940099a480652f.png 48.4 kB [emitted] main-client.js 1 kB 0 [emitted] main-client ERROR in ./ClientApp/boot.browser.ts Module parse failed: C:\App\UserInterface\Web\ClientApp\boot.browser.ts Unexpected token (14:19) You may need an appropriate loader to handle this file type. | const oldRootElem = document.querySelector('app'); | const newRootElem = document.createElement('app'); | oldRootElem!.parentNode!.insertBefore(newRootElem, oldRootElem); | modulePromise.then(appModule => appModule.destroy()); | }); Child ClientApp\app\components\app\app.component.css: Asset Size Chunks Chunk Names 0024f382a52a2ba9f1a59cc50f8b0e57.png 176 kB [emitted] 08a95bcaaa7c8cb522940099a480652f.png 48.4 kB [emitted] Child Hash: 5f6297459713ae759ea7 Time: 10079ms Asset Size Chunks Chunk Names 0024f382a52a2ba9f1a59cc50f8b0e57.png 176 kB [emitted] 08a95bcaaa7c8cb522940099a480652f.png 48.4 kB [emitted] main-server.js 6.79 kB 0 [emitted] main-server ERROR in ./ClientApp/boot.server.ts Module parse failed: C:\App\UserInterface\Web\ClientApp\boot.server.ts Unexpected token (20:20) You may need an appropriate loader to handle this file type. | | return platformDynamicServer(providers).bootstrapModule(AppModule).then(moduleRef => { | const appRef: ApplicationRef = moduleRef.injector.get(ApplicationRef); | const state = moduleRef.injector.get(PlatformState); | const zone = moduleRef.injector.get(NgZone); Child ClientApp\app\components\app\app.component.css: Asset Size Chunks Chunk Names 0024f382a52a2ba9f1a59cc50f8b0e57.png 176 kB [emitted] 08a95bcaaa7c8cb522940099a480652f.png 48.4 kB [emitted] C:\App\UserInterface\Web\UserInterface.Web.Angular.csproj(83,5): error MSB3073: The command "node node_modules/webpack/bin/webpack.js --env.prod" exited with code 2. ``` Running the error command like this causes no issues: `node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js --env.prod` Suggestions on how to get this to publish?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#300
No description provided.