Cannot read property 'thisCompilation' of undefined in Visual Code

10,802

Solution 1

I ended up uninstalling and reinstalling the latest webpack and cli. I then ran ng serve and it compiled successfully.

To remove the webpack: npm remove webpack

To install: npm install --save-dev @angular/cli@latest

Solution 2

I solved this with uninstall webpack and get the 3.11.0 version

npm remove webpack

npm install [email protected]

Solution 3

I had the same issue, made the same mistake of upgrading webpack independently. This is how I was finally able to solve the issue:

npm remove webpack
npm install [email protected]

webpack's newest version (4.0.0) seems to be buggy

Share:
10,802
htmlbran86
Author by

htmlbran86

I am a full-time father (two boys, 9 and 6), husband, and help desk analyst for Kwik Trip in WI. I graduated from Southeast MN Tech with an Associate's degree in Computer Programming & Web Development. I want to get out there and code. Anyone looking to hire a junior developer? I love gaming, reading, carving, and spending time with my family.

Updated on June 16, 2022

Comments

  • htmlbran86
    htmlbran86 almost 2 years

    I am using the latest version of Visual Studio Code. When I run the command 'ng serve' I get the below error:

    enter image description here

    This code is referring to a series of nodes and plugins that I had updated per a previous assignment that compiled without issue. Has anyone run into a similar issue?

  • Hardik Chaudhary
    Hardik Chaudhary about 5 years
    this one fixed my issue too.
  • Viduranga
    Viduranga about 4 years
    I'm dealing with old project, i had same above error. this fixed mine one too!(its a react project xd)