You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
build aot: Error: No module factory available for dependency type: ContextElementDependency #4246
$ 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
I got this same error when I used yarn to install dependencies instead of npm install. Cleaning node modules and running npm install fixed the problem for me.
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.
Reacted by Elad Cohen, Brock Klein, Toni Villena, Joe Lemmer, tom, Florian Vogt, Nicky Lenaers, Eskinder, coffeetea-synchestra and Florian Hartwich
I tried changing to Webpack ~2.2.0 but that didn't do anything. I also tried removing Webpack from DevDependencies and got Error: Cannot find module 'webpack/lib/node/NodeTemplatePlugin'
It happens with ng build. I get a different problem with ng build --aot
Thanks for reporting this issue. This issue is now obsolete due to changes in the recent releases. Please update to the most recent Angular CLI version.
If the problem persists after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior.
Is it possible to reopen this issue.
please see my output on travis. https://travis-ci.org/eskinderg/Angular2
Even though it is working on my local windows 10 machine, it's failing on travis and i could not figure out what.
Thanks.
I downgraded my local and global @angular/cli to 1.0.4,
Removed all the scripts in the packages.json file that were created during the ng enject process including webpack.config.json.
Removed node_moudles and ran npm install again and everything is now working fine.
[ERROR] 12% building modules 21/28 modules 7 active ...de_modules\css-loader\lib\cs
13% building modules 29/43 modules 14 active ...src\app\components\app.component.html
[ERROR] An error occured during the build:
[ERROR] Error: No module factory available for dependency type: ContextElementDependency
[ERROR] at Compilation.addModuleDependencies (E:\WorkSpase\improver\browser\node_modules\@angular\cli\node_modules\webpack\lib\Compilation.js:206:21)
[ERROR] at Compilation.processModuleDependencies (E:\WorkSpase\improver\browser\node_modules\@angular\cli\node_modules\webpack\lib\Compilation.js:195:8)
[ERROR] at _this.buildModule.err (E:\WorkSpase\improver\browser\node_modules\@angular\cli\node_modules\webpack\lib\Compilation.js:336:13)
[ERROR] at building.forEach.cb (E:\WorkSpase\improver\browser\node_modules\@angular\cli\node_modules\webpack\lib\Compilation.js:140:27)
[ERROR] at Array.forEach (native)
[ERROR] at callback (E:\WorkSpase\improver\browser\node_modules\@angular\cli\node_modules\webpack\lib\Compilation.js:140:13)
[ERROR] at module.build (E:\WorkSpase\improver\browser\node_modules\@angular\cli\node_modules\webpack\lib\Compilation.js:167:11)
[ERROR] at resolveDependencies (E:\WorkSpase\improver\browser\node_modules\@angular\cli\node_modules\webpack\lib\ContextModule.js:133:4)
[ERROR] at ContextModule.result.resolveDependencies (E:\WorkSpase\improver\browser\node_modules\@ngtools\webpack\src\plugin.js:229:25)
[ERROR] at ContextModule.build (E:\WorkSpase\improver\browser\node_modules\@angular\cli\node_modules\webpack\lib\ContextModule.js:103:8)
[ERROR] at Compilation.buildModule (E:\WorkSpase\improver\browser\node_modules\@angular\cli\node_modules\webpack\lib\Compilation.js:142:10)
[ERROR] at factoryCallback (E:\WorkSpase\improver\browser\node_modules\@angular\cli\node_modules\webpack\lib\Compilation.js:325:11)
[ERROR] at E:\WorkSpase\improver\browser\node_modules\@angular\cli\node_modules\webpack\lib\ContextModuleFactory.js:96:12
[ERROR] at E:\WorkSpase\improver\browser\node_modules\tapable\lib\Tapable.js:204:11
[ERROR] at done.then (E:\WorkSpase\improver\browser\node_modules\@ngtools\webpack\src\plugin.js:231:28)
[ERROR] at <anonymous>
12% building modules 17/29 modules 12 active ...art/node_modules/zone.js/dist/zone.jsError: No module factory available for dependency type: ContextElementDependency
at Compilation.addModuleDependencies (/home/mike_oldfield/material2-start/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:206:21)
at Compilation.processModuleDependencies (/home/mike_oldfield/material2-start/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:195:8)
at _this.buildModule.err (/home/mike_oldfield/material2-start/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:336:13)
at building.forEach.cb (/home/mike_oldfield/material2-start/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:140:27)
at Array.forEach (native)
at callback (/home/mike_oldfield/material2-start/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:140:13)
at module.build (/home/mike_oldfield/material2-start/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:167:11)
at resolveDependencies (/home/mike_oldfield/material2-start/node_modules/@angular/cli/node_modules/webpack/lib/ContextModule.js:133:4)
at ContextModule.result.resolveDependencies (/home/mike_oldfield/material2-start/node_modules/@ngtools/webpack/src/plugin.js:249:25)
at ContextModule.build (/home/mike_oldfield/material2-start/node_modules/@angular/cli/node_modules/webpack/lib/ContextModule.js:103:8)
at Compilation.buildModule (/home/mike_oldfield/material2-start/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:142:10)
at factoryCallback (/home/mike_oldfield/material2-start/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:325:11)
at /home/mike_oldfield/material2-start/node_modules/@angular/cli/node_modules/webpack/lib/ContextModuleFactory.js:96:12
at /home/mike_oldfield/material2-start/node_modules/tapable/lib/Tapable.js:250:11
at done.then (/home/mike_oldfield/material2-start/node_modules/@ngtools/webpack/src/plugin.js:251:28) 13% building modules 29/36 modules 7 active ...terial2-start/node_modules/rxjs/Rx.js/home/mike_oldfield/material2-start/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:265
if(_this.profile) {
^
TypeError: Cannot read property 'profile' of null
at factoryCallback (/home/mike_oldfield/material2-start/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:265:13)
at factory (/home/mike_oldfield/material2-start/node_modules/@angular/cli/node_modules/webpack/lib/NormalModuleFactory.js:253:5)
at applyPluginsAsyncWaterfall (/home/mike_oldfield/material2-start/node_modules/@angular/cli/node_modules/webpack/lib/NormalModuleFactory.js:99:14)
at /home/mike_oldfield/material2-start/node_modules/tapable/lib/Tapable.js:250:11
at NormalModuleFactory.params.normalModuleFactory.plugin (/home/mike_oldfield/material2-start/node_modules/@angular/cli/node_modules/webpack/lib/CompatibilityPlugin.js:52:5)
at NormalModuleFactory.applyPluginsAsyncWaterfall (/home/mike_oldfield/material2-start/node_modules/tapable/lib/Tapable.js:254:13)
at resolver (/home/mike_oldfield/material2-start/node_modules/@angular/cli/node_modules/webpack/lib/NormalModuleFactory.js:74:11)
at process.nextTick (/home/mike_oldfield/material2-start/node_modules/@angular/cli/node_modules/webpack/lib/NormalModuleFactory.js:205:8)
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:9)
I had a problem when the @angular/cli module version I had was 1.3.0.
All the problems were solved when I ran the npm i @angular/cli --save-dev command.
Try this and Please write a comment~👍
Activity
born2net commentedon Jan 27, 2017
I cleared node_modules, rebuilt project and some clean ups and now gone, so closing,
regards
DennisSmolek commentedon Feb 3, 2017
I'm getting the same error from our codeship build. My local build is fine but it's throwing the same thing exactly. @born2net can you reopen this?
born2net commentedon Feb 3, 2017
yes I can, if need to re-close let me know,
regards
isaacplmann commentedon Feb 13, 2017
I got this same error when I used
yarnto install dependencies instead ofnpm install. Cleaning node modules and runningnpm installfixed the problem for me.filipesilva commentedon Mar 13, 2017
I'll need a simple repro to investigate this if someone has it.
stefannegele commentedon Mar 23, 2017
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.
eladcandroid commentedon Mar 28, 2017
@LasTanzen Thanks for the great tip! I just removed webpack from the DevDependencies and it works
brockklein commentedon Mar 30, 2017
Same as @LasTanzen. Received this error today after upgrading to CLI 1.0.0 (and Angular 4.0.0). Putting Webpack at
~2.2.0fixed it for me.dancancro commentedon Apr 24, 2017
@filipesilva I'm having the problem in this one
https://github.com/dancancro/jhipster-sample-app-ng2/tree/newmodules
I tried changing to Webpack ~2.2.0 but that didn't do anything. I also tried removing Webpack from DevDependencies and got
Error: Cannot find module 'webpack/lib/node/NodeTemplatePlugin'It happens with
ng build. I get a different problem withng build --aotdancancro commentedon Apr 24, 2017
@filipesilva Sorry I hadn't seen your solution from the other issue. Changing
to
eliminated that error. I have other problems with routing so I can't say for sure whether this has any bad consequences.
I had been getting this error:
After making the above change, I am getting this one instead:
filipesilva commentedon May 22, 2017
Thanks for reporting this issue. This issue is now obsolete due to changes in the recent releases. Please update to the most recent Angular CLI version.
If the problem persists after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior.
5 remaining items
eskinderg commentedon Jun 27, 2017
Is it possible to reopen this issue.
please see my output on travis.
https://travis-ci.org/eskinderg/Angular2
Even though it is working on my local windows 10 machine, it's failing on travis and i could not figure out what.
Thanks.
eskinderg commentedon Jul 5, 2017
I downgraded my local and global @angular/cli to 1.0.4,
Removed all the scripts in the packages.json file that were created during the
ng enjectprocess including webpack.config.json.Removed node_moudles and ran npm install again and everything is now working fine.
Hope that helps.
Halynsky commentedon Jul 8, 2017
I have similar problem
Angular - 4.2.5
AngularCLI - 1.2.0
Webpack - 3.1.0
rudzikdawid commentedon Jul 22, 2017
same issue here
npm ls -g --depth=0package.json:
ng serve
source repository: https://github.com/rudzikdawid/material2-start
ChrisWorks commentedon Sep 13, 2017
We have the samme issue
We are runnning:
Node 8.1.4
Angular CLI 1.3.2
When I do a
npm list webpack, I get:--- @angular/cli@1.3.2
--------webpack@3.4.1
----webpack@3.4.1
My package.json looks like this:
We have tried uninstalling webpack, but then we get another error (cant find webpack issue).
Has anyone any ideas how to fix this?
filipesilva commentedon Sep 13, 2017
Heya, see #6417 for information about what causes this problem and how to fix it.
ehdwns980416 commentedon Feb 16, 2018
I had a problem when the @angular/cli module version I had was 1.3.0.
All the problems were solved when I ran the
npm i @angular/cli --save-devcommand.Try this and Please write a comment~👍
rubenspl commentedon Mar 1, 2018
I updated the angular cli to latest version and this working for me.
angular cli before
1.3.2
angular cli after
1.7.2
mariohmol commentedon Mar 28, 2018
i had to set a version for webpack #9794 (comment)
joleelu commentedon Jun 8, 2018
Reference:http://dxtright.com/index.php/2017/12/05/angular-no-module-factory-available-dependency-type-contextelementdependency/
KeyvanAghaie commentedon Jun 11, 2019
your solution is not work for me :(
1- Update Angular cli
2- Update Node.js
3- Rm node_modules
4- npm i
5- ng build --prod --aot
but same error : Runtime compiler is not loaded
angular-automatic-lock-bot commentedon Sep 9, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.