Angular No module factory available for dependency type: ContextElementDependency
Steps I took to fix this problem in case if someone encounters it:
- Package.json: remove webpack from DevDependencies
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
I still don't completely understand the reasons why this happened.
Do npm ls webpack
If you see two versions of webpack
(under @angular/cli and the root node_modules), Then that is the problem. Delete/Rename the webpack under @angular/cli
and in the .bin
folder of @angular/cli
.
Problem solved for me