Skip to content

Cannot find module 'webpack/lib/node/NodeTemplatePlugin' using cli 1.1.1 #6641

Closed
@ialexivy

Description

@ialexivy

OS?

@angular/cli: 1.1.1
node: 8.0.0
os: win32 x64 (Windows 10)
@angular/common: 4.1.3
@angular/compiler: 4.1.3
@angular/core: 4.1.3
@angular/forms: 4.1.3
@angular/http: 4.1.3
@angular/platform-browser: 4.1.3
@angular/platform-browser-dynamic: 4.1.3
@angular/router: 4.1.3
@angular/cli: 1.1.1
@angular/compiler-cli: 4.1.3

Repro steps:

  1. Install node 8 & @angular/cli: 1.1.1
  2. ng new demo
  3. npm start

Failure message:

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. (C:\ng413\demo\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. (C:\ng413\demo\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)

Activity

Markus-Ende

Markus-Ende commented on Jun 12, 2017

@Markus-Ende

Had the same problem, but it turned out that I just forgot to delete the new package-lock file introduced with npm 5. Just deleted this and the node_modules and everything worked as expected after npm install.

thefill

thefill commented on Jun 17, 2017

@thefill

@Markus-Ende solution worked for me. Thx!

toddwseattle

toddwseattle commented on Jun 17, 2017

@toddwseattle

this worked for me as well. might be nice to see a note in the 'upgrading section'.

ghost

ghost commented on Jun 26, 2017

@ghost

@Markus-Ende That did the trick, thank you!

treeder

treeder commented on Jun 30, 2017

@treeder

Could someone explain why we need to delete the lock file?

jkyoutsey

jkyoutsey commented on Jul 6, 2017

@jkyoutsey

I've deleted my lock file and I still get the error. Every time you do an npm install it's going to add the lock file back.

klaascuvelier

klaascuvelier commented on Jul 11, 2017

@klaascuvelier

I have this same issue with angular-cli@1.2.0, but only on our test server, not locally.

I'm not a fan of removing the package-lock file.
Adding webpack as dev-dependency worked for m (got the idea here webpack/webpack#2060). It's not optimal either, but it seems okay is a temporary fix.

piernik

piernik commented on Jul 27, 2017

@piernik

Had the same problem - installing npm i webpack --save-dev sloved it

nulllpointer

nulllpointer commented on Oct 7, 2017

@nulllpointer

Thanks, this solved the issue!!!!

Markus-Ende

Markus-Ende commented on Oct 9, 2017

@Markus-Ende

@treeder the package-lock prevented a new webpack version to be installed (it's like the former npm-shrinkwrap). The version defined in the package-lock file beats the version defined in package.json, so npm i just reinstalled the old webpack files. Deleting the package-lock and then running npm i creates a whole new package-lock file with the latest package versions according to package.json. If you just want to refresh webpack, you can just directly install it via npm i webpack --save-devas @piernik said. Directly installing a package always refreshs the package-lock.

For further documentation about the package-lock see the npm lockfiles documentation on docs.npmjs.com

goeranhomberg

goeranhomberg commented on Nov 12, 2017

@goeranhomberg

npm i webpack --save-dev

worked for me. Thx for the hint 👍

13 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @treeder@klaascuvelier@piernik@toddwseattle@ialexivy

        Issue actions

          Cannot find module 'webpack/lib/node/NodeTemplatePlugin' using cli 1.1.1 · Issue #6641 · angular/angular-cli