build aot: Error: No module factory available for dependency type: ContextElementDependency
See original GitHub issueOS?
angular-cli: 1.0.0-beta.26
node: 6.9.4
os: win32 x64
@angular/common: 2.4.5
@angular/compiler: 2.4.5
@angular/core: 2.4.5
@angular/forms: 2.4.5
@angular/http: 2.4.5
@angular/language-service: 2.4.5
@angular/platform-browser: 2.4.5
@angular/platform-browser-dynamic: 2.4.5
@angular/router: 3.2.1
@angular/compiler-cli: 2.4.5
Repro steps.
Repo: https://github.com/born2net/studioweb
The log given by the failure.
Trying to ng build aot
dump:
$ ng build --aot
25% building modules 128/230 modules 102 active ...modules\@angular\core\src\metadata.js
An error occured during the build:
Error: No module factory available for dependency type: ContextElementDependency
at Compilation.addModuleDependencies (C:\msweb\studioweb\node_modules\webpack\lib\Compilation.js:186:21)
at Compilation.processModuleDependencies (C:\msweb\studioweb\node_modules\webpack\lib\Compilation.js:175:8)
at _this.buildModule.err (C:\msweb\studioweb\node_modules\webpack\lib\Compilation.js:315:13)
at building.forEach.cb (C:\msweb\studioweb\node_modules\webpack\lib\Compilation.js:125:27)
at Array.forEach (native)
at callback (C:\msweb\studioweb\node_modules\webpack\lib\Compilation.js:125:13)
at module.build (C:\msweb\studioweb\node_modules\webpack\lib\Compilation.js:147:11)
at ContextModule.<anonymous> (C:\msweb\studioweb\node_modules\webpack\lib\ContextModule.js:118:3)
at ContextModule.result.resolveDependencies (C:\msweb\angular-cli\packages\@ngtools\webpack\src\plugin.ts:195:25)
at ContextModule.build (C:\msweb\studioweb\node_modules\webpack\lib\ContextModule.js:99:7)
at Compilation.buildModule (C:\msweb\studioweb\node_modules\webpack\lib\Compilation.js:127:10)
at factoryCallback (C:\msweb\studioweb\node_modules\webpack\lib\Compilation.js:304:11)
seems the entire stack is from Webpack and no ref to any part of my code
Regards,
Sean
Issue Analytics
- State:
- Created 7 years ago
- Reactions:7
- Comments:30 (4 by maintainers)
Top Results From Across the Web
Angular No module factory available for dependency type
Steps I took to fix this problem in case if someone encounters it: Package.json: remove webpack from DevDependencies; rm -R node_modules ...
Read more >"No module factory available for dependency type ... - GitHub
"No module factory available for dependency type: ContextElementDependency" after migrating an universal project to Angular 7 #13298.
Read more >No module factory available for dependency type - Medium
Hi, there is an issue when you install Webpack 4 if the @angular-devkit/build-angular@latest included dependency differs from the webpack 4 npm ...
Read more >angular/angular-cli - Gitter
When I run my app locally, I use a proxy to send api requests to a different port on my computer. But if...
Read more >Angular Ahead-of-Time Webpack Plugin - npm
Set to require('webpack/lib/dependencies/ContextElementDependency') if you are having No module factory available for dependency type: ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I had the issue because i manually installed webpack so i had webpack2.3.1 for a different process in the project and was able to fix it by using webpack~2.2.0. Hope that helps.
@LasTanzen Thanks for the great tip! I just removed webpack from the DevDependencies and it works