`ng build` fails with error `Cannot find module 'webpack/lib/node/NodeTemplatePlugin'` after updating to `v1.3.0`
See original GitHub issueBug Report or Feature Request (mark with an x
)
- [x] bug report -> please search issues before submitting
- [ ] feature request
Versions.
λ ng -v
@angular/cli: 1.3.0
node: 8.1.2
os: win32 x64
@angular/animations: 4.3.1
@angular/common: 4.3.1
@angular/compiler: 4.3.1
@angular/core: 4.3.1
@angular/forms: 4.3.1
@angular/http: 4.3.1
@angular/platform-browser: 4.3.1
@angular/platform-browser-dynamic: 4.3.1
@angular/router: 4.3.1
@angular/cli: 1.3.0
@angular/compiler-cli: 4.3.1
@angular/language-service: 4.3.1
Repro steps.
ng build
fails with error Cannot find module 'webpack/lib/node/NodeTemplatePlugin'
after updating to v1.3.0
.
"devDependencies": {
- "@angular/cli": "1.2.7",
+ "@angular/cli": "1.3.0",
The log given by the failure.
λ ng build
Cannot find module 'webpack/lib/node/NodeTemplatePlugin'
Error: Cannot find module 'webpack/lib/node/NodeTemplatePlugin'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (<redacted>\node_modules\html-webpack-plugin\lib\compiler.js:11:26)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (<redacted>\node_modules\html-webpack-plugin\index.js:7:21)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
Mention any other details that might be useful.
Might be related to #6641.
Installing webpack
as a devDependency
can be used as a workaround.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:22
- Comments:20 (2 by maintainers)
Top Results From Across the Web
ng build fails with cannot find module error - Stack Overflow
I renamed all Interfaces and removed the leading I from the names and now the build process is working as expected.
Read more >Cannot find module 'node-sass' on NPM build
node_modules/sass-loader/lib/loader.js): Error: Cannot find module ... I tried running a build 'ng build --prod' locally and didnt encounter any errors.
Read more >Fixing Could not find module @angular-devkit/build-angular ...
To fix Could not find module angular-devkit-build-angular error in Angular follow the below steps 1. Delete node_modules folder and run npm ...
Read more >Identify and Fix Build and Deployment Errors in Your Angular ...
This error occurs most commonly within your development environment (while running ng serve ) when you have created a new module on the ......
Read more >How to fix error upgrading to Angular 13: unhandled exception ...
Home · Blog · How to fix error upgrading to Angular 13: unhandled exception occurred: Cannot find module 'webpack'.
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 faced this issue many times recently and always the fix worked for me is :
rm -rf node_modules rm package-lock.json npm cache verify npm install