ng build Cannot find module 'webpack/lib/node/NodeTemplatePlugin' after ng update
See original GitHub issue- I installed the global angular cli
- Cloned repository https://github.com/splincode/css-unused-angular
- Run $ ng update
- And further on the scheme below:
Versions
before (see repo https://github.com/splincode/css-unused-angular) package.json (after ng update)
{
"name": "css-usage",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build --prod",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "5.2.5",
"@angular/common": "5.2.5",
"@angular/compiler": "5.2.5",
"@angular/core": "5.2.5",
"@angular/forms": "5.2.5",
"@angular/http": "5.2.5",
"@angular/platform-browser": "5.2.5",
"@angular/platform-browser-dynamic": "5.2.5",
"@angular/router": "5.2.5",
"core-js": "^2.4.1",
"rxjs": "^5.5.6",
"zone.js": "^0.8.20"
},
"devDependencies": {
"@angular/cli": "1.7.0",
"@angular/compiler-cli": "5.2.5",
"@angular/language-service": "5.2.5",
"@types/jasmine": "~2.8.3",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"codelyzer": "^4.0.1",
"jasmine-core": "~2.8.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~2.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"materialize-css": "^0.100.2",
"protractor": "~5.1.2",
"ts-node": "~4.1.0",
"tslint": "~5.9.1",
"typescript": "2.6.2"
}
}
Repro steps
$ ng -v
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 1.7.0
Node: 9.5.0
OS: win32 x64
Angular: 5.2.5
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
@angular/cli: 1.7.0
@schematics/package-update: 0.3.1
typescript: 2.6.2
webpack: error
$ npm i
> uws@0.14.5 install D:\dev\css-unused-angular\node_modules\uws
> node-gyp rebuild > build_log.txt 2>&1 || exit 0
> node-sass@4.7.2 install D:\dev\css-unused-angular\node_modules\node-sass
> node scripts/install.js
Cached binary found at C:\Users\splincode\AppData\Roaming\npm-cache\node-sass\4.7.2\win32-x64-59_binding.node
> uglifyjs-webpack-plugin@0.4.6 postinstall D:\dev\css-unused-angular\node_modules\@angular\cli\node_modules\webpack\node_modules\uglifyjs-webpack-plugin
> node lib/post_install.js
> node-sass@4.7.2 postinstall D:\dev\css-unused-angular\node_modules\node-sass
> node scripts/build.js
Binary found at D:\dev\css-unused-angular\node_modules\node-sass\vendor\win32-x64-59\binding.node
Testing binary
Binary is fine
npm WARN cache-loader@1.2.0 requires a peer of webpack@^2.0.0 || ^3.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN schema-utils@0.4.5 requires a peer of webpack@^2.0.0 || ^3.0.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @schematics/package-update@0.3.1 requires a peer of @angular-devkit/core@0.3.1 but none is installed. You must install peer dependencies yourself.
npm WARN @schematics/package-update@0.3.1 requires a peer of @angular-devkit/schematics@0.3.1 but none is installed. You must install peer dependencies yourself.
$ ng build
Cannot find module 'webpack/lib/node/NodeTemplatePlugin'
Error: Cannot find module 'webpack/lib/node/NodeTemplatePlugin'
at Function.Module._resolveFilename (module.js:555:15)
at Function.Module._load (module.js:482:25)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (D:\dev\css-unused-angular\node_modules\html-webpack-plugin\lib\compiler.js:11:26)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (D:\dev\css-unused-angular\node_modules\html-webpack-plugin\index.js:7:21)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
If I delete package-lock.json and again do npm i, so, will work. Do not you have to take into account the incorrect versions in package-lock.json?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Cannot find module 'webpack' - Angular - Stack Overflow
I just migrated my project from angular v5.x to v6.x and now when I try to start it with ng serve I'm getting:...
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 >ngx-build-plus - npm
ng build --single-bundle : Puts everything reachable from the main entry point into one bundle. Polyfills, scripts, and styles stay in their own ......
Read more >Cannot find module '@angular-devkit/build-angular ... - YouTube
An unhandled exception occurred: Cannot find module '@angular-devkit/ build -angular/package.json'The above exception while running an angular ...
Read more >Cannot find module '@angular/core' error | bobbyhadz
To solve the error "Cannot find module '@angular/core'", make sure you ... try to update the versions of your NPM packages by running...
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
Can confirm, deleting node_modules and package-lock.json fixes this issue.
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.