asp.netasp.net-coreasp.net-core-mvcasp.net-core-2.0wwwroot

ASP.NET Core application won't run: no DIST folder and "Cannot find module './wwwroot/dist/vendor-manifest.json'"


I have pulled an existing ASP.NET Core application that previously worked on a different computer.

When I run the application on this computer, I get the following error:

AggregateException: One or more errors occurred. (Cannot find module './wwwroot/dist/vendor-manifest.json'
Error: Cannot find module './wwwroot/dist/vendor-manifest.json'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)

If I Google that, I end up here, but if I run that I get:

PM> webpack --config webpack.config.vendor.js
webpack : C:\node_modules\webpack-cli\bin\webpack.js:242
At line:1 char:1
+ webpack --config webpack.config.vendor.js
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (C:\node_modules...\webpack.js:242:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

                throw err;
                ^

Error: Cannot find module 'C:\Users\LarsHoldgaard\Documents\Github\Likvido.CreditRisk\Likvido.CreditRisk\webpack.config.vendor.js'
    at Function.Module._resolveFilename (module.js:547:15)

Now, this is weird to me.

I have tried to run the npm install and aspnet restore. I can run the Grunt (task runner) without failures. NPM / Node is in my PATH and I run on Windows.

I do not have a wwwroot/DIST folder from any of these actions, which I guess is the problem.

Any idea what I am doing wrong here? :-)

EDIT:

Marc asked me if it is in the tree. Apparently, it is:

enter image description here

I am unsure how this changes things.


Solution

  • This was probably a caching problem, based on I just installed Node.js+NPM and Webpack.

    What I did was the following:

    1. Made sure to restart my computer
    2. Verify that all dependencies was good: Node.js+NPM installed, Node in PATH, Webpack installed globally
    3. Clean everything in my solution
    4. Rebuild in Visual Studio

    It suddenly started working in my end after a couple of times, so pretty sure it's some local cache that caused the problem from not having the dependencies in order.

    Another trick I tried was to pull an earlier version of the application from my repo, which seemed to "refresh" the cache (or whatever was the problem). After going back to an earlier version and then back to the newest, things just worked.