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

4

11

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.

Belding answered 9/4, 2018 at 14:0 Comment(8)
Do you have a webpack.config.vendor.js somewhere else in the tree?Quigley
@MarcLaFleur Please see my edit :) How this can help!Belding
I think the main problem is that the DIST folder is not being madeBelding
@LarsHoldgaard try to run this command on root folder webpack --config webpack.config.vendor.jsSkiascope
@Skiascope That gives me the second error in the original question, which is weird because: prntscr.com/j36t8g <-- the file should be there at that pathBelding
ok, I believe second error is the one that you need to resolve, can you try to create new project of your kind and build webpack? it will give you idea on this error.Skiascope
@Skiascope Actually a great point. I could create a new solution and it worked, so I guess it's installed correctly in my PATH and the global packages are in order. I could also build and got a DIST folder in the other solution... Interesting... Gives some room to debugBelding
@LarsHoldgaard you are on the right way now, carry on..Skiascope
B
6

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.

Belding answered 11/4, 2018 at 14:23 Comment(1)
after installing webpack and run the command line in the other answer, a clean and rebuild did the job.Jerroldjerroll
D
29

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
Disengage answered 25/6, 2018 at 9:43 Comment(1)
This fixed my issue alsoPterosaur
B
6

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.

Belding answered 11/4, 2018 at 14:23 Comment(1)
after installing webpack and run the command line in the other answer, a clean and rebuild did the job.Jerroldjerroll
P
0

Open package.config and note down the production build script name. Here it is production

// package.json    

{
      "name": "my-proj",
      "version": "1.0.0",
      "private": true,
      "scripts": {
        "start:dev": "cross-env DEBUG=true webpack-dev-server",
        "production": "webpack -p"
      },
      "devDependencies": {
      ...

Then execute the command

C:\my-proj>>npm run production

This will create the dist folder

Then run the project

Papyraceous answered 21/10, 2021 at 7:37 Comment(0)
I
-1

I was having the same issues. The following worked for me:

1) Clean Solution
2) Rebuild Solution
3) Run the Project
Interscholastic answered 19/6, 2019 at 0:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.