Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getting MockMatchMedia error #1925

Closed
Nehadigi opened this issue Dec 5, 2018 · 4 comments
Closed

getting MockMatchMedia error #1925

Nehadigi opened this issue Dec 5, 2018 · 4 comments

Comments

@Nehadigi
Copy link

Nehadigi commented Dec 5, 2018

After npm start getting this "ERROR in src/app/shared/shared.module.ts(4,34): error TS2307: Cannot find module '@angular/flex-layout'"
and when install @angular/flex-layout then getting this error.

ERROR in node_modules/@angular/flex-layout/core/typings/match-media/mock/mock-match-media.d.ts(25,15): error TS2416: Property '_registry' in type 'MockMatchMedia' is not assignable to the same property in base type 'MatchMedia'.

@duongtranfu
Copy link

Same issue here

@ArmandBahi
Copy link

Same issue too

@koelle25
Copy link

koelle25 commented Dec 6, 2018

I get a similar error when using the docker method:

ERROR in app/shared/shared.module.ts(48,5): Error during template compile of 'SharedModule'
  Could not resolve @angular/flex-layout relative to /usr/src/app/src/app/shared/shared.module.ts..
src/app/shared/shared.module.ts(4,34): error TS2307: Cannot find module '@angular/flex-layout'.

Adding "@angular/flex-layout": "^6.0.0-beta.16" to package.json seems to fix it.

EDIT: Apparently, it only fixes the above error but creates new problems. Now I'm getting the following errors when starting the application (npm start):

[BUILD] Error: No module factory available for dependency type: ContextElementDependency
[BUILD]     at addDependency (/home/kevin/Docker/mean/node_modules/webpack/lib/Compilation.js:694:12)
[BUILD]     at iterationOfArrayCallback (/home/kevin/Docker/mean/node_modules/webpack/lib/Compilation.js:194:3)
[BUILD]     at addDependenciesBlock (/home/kevin/Docker/mean/node_modules/webpack/lib/Compilation.js:712:5)
[BUILD]     at iterationOfArrayCallback (/home/kevin/Docker/mean/node_modules/webpack/lib/Compilation.js:194:3)
[BUILD]     at addDependenciesBlock (/home/kevin/Docker/mean/node_modules/webpack/lib/Compilation.js:715:5)
[BUILD]     at Compilation.processModuleDependencies (/home/kevin/Docker/mean/node_modules/webpack/lib/Compilation.js:723:4)
[BUILD]     at afterBuild (/home/kevin/Docker/mean/node_modules/webpack/lib/Compilation.js:855:15)
[BUILD]     at buildModule.err (/home/kevin/Docker/mean/node_modules/webpack/lib/Compilation.js:899:11)
[BUILD]     at callback (/home/kevin/Docker/mean/node_modules/webpack/lib/Compilation.js:628:5)
[BUILD]     at module.build.error (/home/kevin/Docker/mean/node_modules/webpack/lib/Compilation.js:676:12)
[BUILD]     at resolveDependencies (/home/kevin/Docker/mean/node_modules/webpack/lib/ContextModule.js:282:4)
[BUILD]     at ContextModule.result.resolveDependencies (/home/kevin/Docker/mean/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:497:25)
[BUILD]     at ContextModule.build (/home/kevin/Docker/mean/node_modules/webpack/lib/ContextModule.js:203:8)
[BUILD]     at Compilation.buildModule (/home/kevin/Docker/mean/node_modules/webpack/lib/Compilation.js:633:10)
[BUILD]     at factory.create (/home/kevin/Docker/mean/node_modules/webpack/lib/Compilation.js:882:14)
[BUILD]     at hooks.afterResolve.callAsync (/home/kevin/Docker/mean/node_modules/webpack/lib/ContextModuleFactory.js:163:16)

As far as I could find out it is because the dependency "@angular-devkit/build-angular": "~0.7.0-beta.1" installs an own webpack-version and so there are two versions (because of "webpack": "^4.26.1") which interfere with each other.
The following worked for me:

npm remove --save webpack
rm -r node_modules
rm package-lock.json
npm install

See also here: Angular/universal-starter #581

@yogesh2022
Copy link

yogesh2022 commented Dec 19, 2018

This issue is because of webpack... Steps I took to fix this problem:

Package.json: remove webpack from Dependencies
rm -R node_modules (remove node_modules folder)
npm i -g webpack
npm i -g webpack-dev-server
remove package-lock.json (if it's there)
npm i
npm start

Also for @angular/flex-layout', you can comment that code and try rebuilding the app.
@Nehadigi @duongtranfu @ArmandBahi @koelle25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants