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

Error: No module factory available for dependency type: ContextElementDependency #163

Closed
AnthonyNahas opened this issue Jun 3, 2018 · 1 comment

Comments

@AnthonyNahas
Copy link
Collaborator

AnthonyNahas commented Jun 3, 2018

I've just generated a new library, and facing the following issue in the demo app.

Bug Report or Feature Request (mark with an x)

- [x ] bug report -> please search issues before submitting
- [ ] feature request

OS and Version?

Mac OS highSierra

Generator Version

"version": "6.0.0",

but I guess that I have the latest version 6.0.1 maybe the version was not bumped in the last release

-->

{
  "_from": "generator-ngx-library@latest",
  "_id": "generator-ngx-library@6.1.0",
  "_inBundle":  #false,

Tools Version

yo --version: 2.0.2
node --version: 8.11.2
npm -v: 6.1.0

Targeted Angular version

V6

Repro steps.

  1. generate a new project
  2. cd demo
  3. npm i
  4. ng serve

The log given by the failure.

angular-material-extensions/test/demo $ ng serve
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
 13% building modules 30/44 modules 14 active …e_modules/@angular/forms/fesm5/forms.js✖ 「wdm」: Error: No module factory available for dependency type: ContextElementDependency
    at addDependency (/Users/admin/Git/angular-material-extensions/test/demo/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/Compilation.js:407:12)
    at iterationOfArrayCallback (/Users/admin/Git/angular-material-extensions/test/demo/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/Compilation.js:88:3)
    at addDependenciesBlock (/Users/admin/Git/angular-material-extensions/test/demo/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/Compilation.js:423:5)
    at iterationOfArrayCallback (/Users/admin/Git/angular-material-extensions/test/demo/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/Compilation.js:88:3)
    at addDependenciesBlock (/Users/admin/Git/angular-material-extensions/test/demo/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/Compilation.js:426:5)
    at Compilation.processModuleDependencies (/Users/admin/Git/angular-material-extensions/test/demo/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/Compilation.js:434:4)
    at afterBuild (/Users/admin/Git/angular-material-extensions/test/demo/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/Compilation.js:556:15)
    at buildModule.err (/Users/admin/Git/angular-material-extensions/test/demo/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/Compilation.js:600:11)
    at callback (/Users/admin/Git/angular-material-extensions/test/demo/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/Compilation.js:358:35)
    at module.build.error (/Users/admin/Git/angular-material-extensions/test/demo/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/Compilation.js:394:12)
    at resolveDependencies (/Users/admin/Git/angular-material-extensions/test/demo/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/ContextModule.js:233:4)
    at ContextModule.result.resolveDependencies (/Users/admin/Git/angular-material-extensions/test/demo/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:476:25)
    at ContextModule.build (/Users/admin/Git/angular-material-extensions/test/demo/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/ContextModule.js:158:8)
    at Compilation.buildModule (/Users/admin/Git/angular-material-extensions/test/demo/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/Compilation.js:362:10)
    at factory.create (/Users/admin/Git/angular-material-extensions/test/demo/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/Compilation.js:583:14)
    at hooks.afterResolve.callAsync (/Users/admin/Git/angular-material-extensions/test/demo/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/ContextModuleFactory.js:150:16)

Desired functionality.

should serve the demo app

Mention any other details that might be useful.

webpack is duplicated.. because angular cli has a dependency to webpack too...

SOLVED:

  1. cd demo
  2. npm rm webpack
  3. rm -rf node_modules package-lock.json
  4. npm i
  5. ng serve

🎉 and it works

so you should remove webpack from the package.json from the demo directory

thank you

@tinesoft
Copy link
Owner

tinesoft commented Jun 4, 2018

I agree the dependency may be redundant with cli's, but still, it shouldn't cause this error... (i tried installing demo deps with yarn and it worked fine, no error on gulp serve:demo...)

Anyway, i removed it

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

2 participants