survivejs / webpack-book

From apprentice to master (CC BY-NC-ND)
https://survivejs.com/webpack/
2.42k stars 319 forks source link

Cannot find module 'html-webpack-plugin' #100

Closed bitwerk closed 7 years ago

bitwerk commented 8 years ago

The solution was to run npm i html-webpack-plugin --save-dev before building with webpack.

OS: Windows 10 Node: v6.3.1 Book page: 6 (at 'If you execute node_modules/.bin/webpack, you should see output ...) Stacktrace:

C:\work\webpack-demo>node_modules\.bin\webpack.cmd
module.js:442
    throw err;
    ^

Error: Cannot find module 'html-webpack-plugin'
    at Function.Module._resolveFilename (module.js:440:15)
    at Function.Module._load (module.js:388:25)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\work\webpack-demo\webpack.config.js:2:27)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
C:\work\webpack-demo>node_modules\.bin\webpack.cmd
module.js:442
    throw err;
    ^

Error: Cannot find module 'html-webpack-plugin'
    at Function.Module._resolveFilename (module.js:440:15)
    at Function.Module._load (module.js:388:25)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\work\webpack-demo\webpack.config.js:2:27)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
bebraw commented 8 years ago

Hi,

There's a snippet like To keep things simple to maintain, we'll be using html-webpack-plugin to generate an index.html for our application. html-webpack-plugin wires up the generated assets with it. Install it in the project: just before If you execute node_modules/.bin/webpack, you should see output.

Is it possible you missed that?

Thanks for the report. 👍

bebraw commented 7 years ago

Time to close. Thanks!

SAWC98 commented 6 years ago

same, I'm also following this error but not understanding how to resolve.

bebraw commented 6 years ago

@SAWC98 Can you link me to your project? It's important to have the plugin installed.

keshav123ram commented 5 years ago

Run below commond it will work 100%,i was facing same issue got resolve it. npm install html-webpack-plugin