'Module not found: Error: Can't resolve '@angular/flex-layout' in '/app'

I suddenly got this error

Module not found: Error: Can't resolve '@angular/flex-layout' in '\src\app'

This error occurred After I have install @angular/cdk,

After this error I have again installed flex-layout using

 npm install @angular/flex-layout

But now there is error for

Module not found: Error: Can't resolve '@angular/http' in '\src\app'

If I Install a http, then some other module is getting missed. How to stop this situation? What has gone wrong?

If I install @angular/http then again it starts with

Module not found: Error: Can't resolve '@angular/flex-layout' in '\src\app'


Solution 1:[1]

Install the below package to avoid this issue.

npm install @angular/flex-layout

OR add the below code in package.json and do the npm install

"@angular/flex-layout":"12.0.0-beta.34"

Solution 2:[2]

For me, the issue was with the @angular/cdk version.@angular/flex-layout required version 12.0.0 for installation. Simply go to package.json and change the @angular/cdk version to 12.0.0. Then run npm install -s @angular/flex-layout

Solution 3:[3]

Try to keep the same version of angular cdk and angular/flex-layout. for me also having same issue due to layout version was higher than angular c

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Ekta arora
Solution 3 TopsCreative