Jaaayz
Jaaayz

Reputation: 1563

Module build failed: Error: AotPlugin was detected but it was an instance of the wrong class

I tried to upgrade the webpack into the latest version because of the issue in the live reload in the older versions when running an angular app. In the previous scenario everything works fine I just have a problem with live reload. So I upgraded it to the latest version of webpack that it was said in the issue of older versions of webpack.

So when I upgraded it to the latest version. I encountered this error now when running ng serve.

ERROR in ./src/main.ts Module build failed: Error: AotPlugin was detected but it was an instance of the wrong class. This likely means you have several @ngtools/webpack packages installed. You can check this with npm ls @ngtools/webpack, and then remove the extra copies. at Object.ngcLoader (/home/jayzdevera/Documents/ad-fingerprinting/web/node_modules/@ngtools/webpack/src/loader.js:430:19) @ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts ERROR in ./src/polyfills.ts Module build failed: Error: AotPlugin was detected but it was an instance of the wrong class. This likely means you have several @ngtools/webpack packages installed. You can check this with npm ls @ngtools/webpack, and then remove the extra copies. at Object.ngcLoader (/home/jayzdevera/Documents/ad-fingerprinting/web/node_modules/@ngtools/webpack/src/loader.js:430:19) @ multi ./src/polyfills.ts

npm ls @ngtools/webpack

@angular/[email protected]
│ └── @ngtools/[email protected] 
└── @ngtools/[email protected] 

I am using Ubuntu 16.04

Aprreciate if someone can help. Thanks in advance.

Upvotes: 3

Views: 988

Answers (1)

Damo
Damo

Reputation: 6433

I recently had a similar problem with @angular/[email protected] and @ngtools/[email protected]

├─┬ @angular/[email protected]
│ └── @ngtools/[email protected]
└── @ngtools/[email protected]

Follow the instructions here https://github.com/angular/angular-cli/wiki/stories-1.0-update

npm uninstall -g angular-cli
npm uninstall --save-dev angular-cli

npm uninstall -g @angular/cli
npm uninstall --save-dev @angular/cli 

rm -rf node_modules dist
npm cache clean

npm install -g @angular/cli@latest
npm install --save-dev @angular/cli@latest
npm install   

Upvotes: 1

Related Questions