TrilonIO / aspnetcore-angular-universal

ASP.NET Core & Angular Universal advanced starter - PWA w/ server-side rendering for SEO, Bootstrap, i18n internationalization, TypeScript, unit testing, WebAPI REST setup, SignalR, Swagger docs, and more! By @TrilonIO
https://www.trilon.io
MIT License
1.46k stars 434 forks source link

Visual Studio 2017 - webpack.js exited with code 2. #707

Open WilbertE opened 5 years ago

WilbertE commented 5 years ago

Hi,

What I have done: Reinstalled Visual Studio 2017 Reinstalled NodeJs Downloaded aspnetcode-angular-universal Opened it with Visual Studio Added 'c:\program files\nodejs' in Visual Studio > Tools > Options >Projects and Solutions > Web Package Management > External Web Tools

Then I hit 'Run' and in the end Visual Studio comes up with: "MSB3073 - The command 'node node_modules/webpack/bin/webpack.js' exited with code 2".

I have tried numerious things but I cannot get past this error. When I hit 'run' again. The project launces and works (ssr) but after a second or so an overlay pops up with some errors (see screenshot)

When I remove this overlay (by setting it to display:none in Chrome dev tools) the project itself (Angular app) works without problems.

How can I fix this error?

error

----------EDIT------------ If I just delete the file stated in the error (counter.component.spec.ts) it does works. Is there something wrong with this file?

MarkPieszak commented 5 years ago

There isn't but it's strange that your dev version is picking up *.spec.ts files, since they should be getting ignored via the tsconfig here: https://github.com/MarkPieszak/aspnetcore-angular-universal/blob/master/ClientApp/tsconfig.app.json#L12

Is that file modified or anything?

WilbertE commented 5 years ago

Nothing was modified. I did a re-install for VS2017. Reinstall of Node. Only thing extra what I did was 'Added 'c:\program files\nodejs' in Visual Studio > Tools > Options >Projects and Solutions > Web Package Management > External Web Tools'. Then I downloaded the project zip. Extracted it. Double clicked Asp2017.sln file. Project opened in VS2017. It started to download all dependencies. Then I hit run and I got this error.

No single file is modified. Just download and unzip.

The **/*.spec.ts is in there like you said. It is however a hidden file in the Solution Explorer. (see screenshot).

------ Update ------ I made a video showing what I exactly do. See video (I pause the video on long loading times)

vs2017

alexbenitez commented 5 years ago

All of the sudden we started having this same issue in our project which is based on the starter. Pre-existing local repositories are OK... only when we create a new clone of our project we see the issue so probably there is some update causing indirectly the problem?

Using VS Code.

alexbenitez commented 5 years ago

I re-installed @types/jasmine@2.8.7 (the version that I already had) and re-started to work. I had tried clearing the npm cache before this but for some reason that wasn't enough... it was until I re-ran the install --save when finally worked.

We had the problem in two different development machines and solved the same way.

MarkPieszak commented 5 years ago

I wonder if jasmine had some issues and they patched that version and it ended up fixing it. I've seen this before (years ago) surprised to see it come up again!

Glad you got it fixed though :+1:

ntrpnr commented 5 years ago

I have the same issue. Cmd, Windows. Tried to reinstall @types/jasmine without success.

alexbenitez commented 5 years ago

@ntrpnr today I had a third dev machine with the issue.... try specifying the version and —save-dev

In our case, it is consistently reproduced and fixed as follow.

ovresko commented 5 years ago

Same issue, fresh clone reinstall all same result.