Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 716
Lars Holdgaard Avatar asked Apr 09 '18 14:04

Lars Holdgaard


2 Answers

My problem solved by running these commands :

node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js
node node_modules/webpack/bin/webpack.js
like image 184
Sadegh Ghanbari Avatar answered Oct 21 '22 05:10

Sadegh Ghanbari


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.

like image 43
Lars Holdgaard Avatar answered Oct 21 '22 04:10

Lars Holdgaard