angular-cli: Cannot find module 'webpack/lib/node/NodeTemplatePlugin'

After upgrading to 1.4.5 (Windows 10, Node 8.6.0) and running ng serve I get this error:

Cannot find module ‘webpack/lib/node/NodeTemplatePlugin’

I rebooted my machine, reinstalled all npm packages, nothing helps.

Basically, this is a blocking issue.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 10
  • Comments: 21 (4 by maintainers)

Most upvoted comments

after doing :

remove node_modules
remove package-lock.json
npm cache clean -f

works again for me!

hi guys, maybe try deleting node_modules & package-lock.json files. at least i solve the problem.

having the same problem Cannot find module 'webpack/lib/node/NodeTemplatePlugin' For me last working version of @angular/cli was 1.5.0-rc.2 RC3 -> RC8 doesn’t work. npm --version: 5.5.1 node modules are installed correctly.

update: Install webpack as a devDependency. Fixed for me.

For me this solved the problem after deleting node_modules and installing again with nmp install

npm remove webpack -g npm i webpack --save-dev npm run webpack

I had the same issue but on our CI. I downgraded the CLI from 1.4.5 to 1.4.4 and that fixed my issue