Angular-cli: CLI 1.5.0 not installing Webpack? "Cannot find module 'webpack/lib/dependencies/ContextElementDependency'"

Created on 2 Nov 2017  路  8Comments  路  Source: angular/angular-cli

Bug Report or Feature Request (mark with an x)

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

Versions.

Angular CLI: 1.5.0
Node: 6.10.3
OS: win32 x64
Angular: 5.0.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router

@angular/cdk: 2.0.0-beta.8
@angular/cli: 1.5.0
@angular/material: 2.0.0-beta.8
@angular-devkit/build-optimizer: 0.0.32
@angular-devkit/core: 0.0.20
@angular-devkit/schematics: 0.0.35
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.0
@schematics/angular: 0.1.0
typescript: 2.4.2
webpack: error

Repro steps.

  1. Update dependencies of existing project from Angular 4/CLI 1.4 to Angular 5/CLI 1.5
  2. run ng serve.

Also tried deleting node_modules/reinstalling but same error.

The log given by the failure.

Cannot find module 'webpack/lib/dependencies/ContextElementDependency'
Error: Cannot find module 'webpack/lib/dependencies/ContextElementDependency'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Users\greg.mcgee\Source\Workspaces\WBAC_US\Main\Develop\Angular\wbac-vpw\node_modules\@ngtools\webpack\src\plugin.js:8:34)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)

Desired functionality.


CLI starts build without error.

Most helpful comment

Deleted my package-lock.json file and removed/reinstalled node_modules and it worked. Not sure where the incompatibility was.

All 8 comments

I had it when used ngc-webpack plugin. Also reinstall packages might help

same problem

Addendum: After installing Webpack manually, the project builds fine.

It seems as though you had a bad npm install. You should not have to install webpack manually. Glad all is working for you.

I removed node_modules and reinstalled again and am still having this issue. I had said in my first post that I had removed/reinstalled modules and it didn't work.

Deleted my package-lock.json file and removed/reinstalled node_modules and it worked. Not sure where the incompatibility was.

delete the package-lock.json did it! Thx

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._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MateenKadwaikar picture MateenKadwaikar  路  3Comments

rajjejosefsson picture rajjejosefsson  路  3Comments

delasteve picture delasteve  路  3Comments

jmurphzyo picture jmurphzyo  路  3Comments

rwillmer picture rwillmer  路  3Comments