Cannot find module ‘./wwwroot/dist/vendor-manifest.json

Hi Friends,

Thought to share one of the errors which I usually face, whenever I switch machine. Scenario is I am working on any greenfield project which is basically an angular 4 project with asp.net core. I have a habit of keeping my code on source control which is git in this case. However, when I clone the same on different machine and install my usual dependencies with npm install; soon after that when I run my app, it gives me below error.

1st

Therefore, the reason is very obvious. If I look at my solution explorer and look at wwwroot folder, you will see there is no dist folder here.

2nd

Therefore, we need to run webpack to create our bundles. First we need to create our vendor bundle with the below command.

webpack –config webpack.config.vendor.js

This will give following confirmation in your command prompt.

3rd

Once this is done. Then, we need to create our main bundle with command webpack as shown below.

4th

With the above changes in place, if I look at my solution explorer, then I can see that dist folder has been restored in my wwwroot folder.

5th

Now, When I go ahead and run my app, it will run fine.

6th

I hope you would have liked today’s discussion. Thanks for Joining me.

Thanks,
Rahul Sahay
Happy Coding

1,224 total views, 7 views today