dsuryd/dotNetify-react-template

Cannot find module 'aspnet-webpack'

birksy89 opened this issue · 3 comments

Hello, just thought I'd flag this error I got out of the box

"Webpack dev middleware failed because of an error while loading 'aspnet-webpack'. Error was: Error: Cannot find module 'aspnet-webpack'

To fix, I ran the command:

npm install aspnet-webpack --save-dev

But reading the npm page, this might not be the best solution?

Hi, I have not seen any issue when testing it in three different systems, but that module error would occasionally occur when npm packages were not completely restored (usually by Visual Studio). Your fix is correct, although you can just run npm i or right-click package.json from inside VS and select 'Restore Packages', since the aspnet-webpack module is already defined inside the file.

Ahhh sorry - I've just had a look around and I can see the difference.

Yesterday I had a look at the "Dashboard" example:
https://github.com/dsuryd/dotnetify-react-demo-vs2017/tree/master/ReactTemplate

And this worked just fine, and I was excited - But a bit overwhelmed, and my plan was to dial back and start at the basics...

Looking in it's package.json - I can see a lot more packages / dependencies - inc the aspnet-webpack one.

So today, I've just tried running the "HelloWorld" example, here:
https://github.com/dsuryd/dotnetify-react-demo-vs2017/tree/master/HelloWorld

This package.json file is a bit more sparse, and is lacking the aspnet-webpack reference.

Thank you for responding :)

Ah, of course! I recently updated HelloWorld to use aspnet-webpack but forgot to update package.json, and it worked because the module already exists in my node_modules . Thank you, I will fix this right away!