Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR in Module build failed (from ./node_modules/@angular-devkit/build-angular/node_modules/mini-css-extract-plugin/dist/loader.js)

Tags:

angular

When I run ng build --prod get this error. It can serve without error but it can't build. I relay tied with that

ERROR in Module build failed (from ./node_modules/@angular-devkit/build-angular/node_modules/mini-css-extract-plugin/dist/loader.js):       
TypeError: Cannot read property 'replace' of undefined
    at normalizeBackSlashDirection (C:\project\tea supply chain mangement system\test2\node_modules\webpack\lib\RequestShortener.js:16:17)  
    at new RequestShortener (C:\project\tea supply chain mangement system\test2\node_modules\webpack\lib\RequestShortener.js:26:15)
    at new Compiler (C:\project\tea supply chain mangement system\test2\node_modules\webpack\lib\Compiler.js:195:27)
    at Compiler.createChildCompiler (C:\project\tea supply chain mangement system\test2\node_modules\webpack\lib\Compiler.js:548:25)        
    at Compilation.createChildCompiler (C:\project\tea supply chain mangement system\test2\node_modules\webpack\lib\Compilation.js:2100:24) 
    at Object.pitch (C:\project\tea supply chain mangement system\test2\node_modules\@angular-devkit\build-angular\node_modules\mini-css-extract-plugin\dist\loader.js:89:43)

My dependencies:

"dependencies": {
  "@agm/core": "^1.1.0",
    "@angular/animations": "8.2.14",
    "@angular/cdk": "^8.2.3",
    "@angular/common": "8.2.14",
    "@angular/compiler": "8.2.14",
    "@angular/core": "^8.2.14",
    "@angular/http": "^7.2.15",
    "@angular/material": "^8.2.3",
    "@angular/router": "8.2.14",
       ....
    "web3": "^1.2.4",
    "zone.js": "0.9.1"   
},   
   "devDependencies": {  
   "@angular-builders/custom-webpack": "^8.4.1",
    "@angular-builders/dev-server": "^7.3.1",
    "@angular-devkit/build-angular": "^0.803.21",
    "@angular-devkit/architect": "^0.803.21",
    "@angular/cli": "^8.3.21",
    "@angular/compiler-cli": "^8.2.14",
    "@angular/language-service": "8.2.14",
    .....
  }

How to solve this error?

like image 604
Tharindu Vindula Avatar asked Dec 26 '19 14:12

Tharindu Vindula


People also ask

How to fix could not find module @angular-Devkit/build-angular error?

Further you can try to re-install Angular cli to fix Could not find module @angular-devkit/build-angular error. Follow the below steps to re-install Angular CLI.

Why am I getting error when upgrading angular to angular 6?

So if you upgrade your application from older version of Angular to Angular 6 or higher, there is a chance that you will get this error. Unfortunately there is no straight way to fix this issue.

How to install angular in NodeJS?

1st Step: Open the node_modules folder present in the project. 2nd Step: check for the folder @build-angular. 3rd Step: if the folder is not present then try to install @angular-devkit/build-angular using following command in command prompt. npm i.

How to install older versions of angular packages using NPM?

But our local Angular application will have older versions of packages installed in node_modules folder. So delete the node_modules folder manually from the application directory. After that clear the cache using npm cache clean --verify. And then run npm install command.


Video Answer


2 Answers

The discussion at https://github.com/webpack-contrib/mini-css-extract-plugin/issues/186 includes a statement that this error occurs when any component has a styleUrls property whose array value has a length greater than 1.

I verified this in an application where reducing the value of this property to an array of length 1 made the error disappear.

like image 91
Jonathan Pool Avatar answered Oct 16 '22 23:10

Jonathan Pool


in my case some css not work properly that's why get this error.it found when i check one by one. because this error hidden other errors.

like image 1
Tharindu Vindula Avatar answered Oct 17 '22 00:10

Tharindu Vindula