Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR in Error: Child compilation failed: Cannot find module 'handlebars'

I've recently erased all node_modules and did a fresh npm install. And keep getting this error:

ERROR in   Error: Child compilation failed:
  Cannot find module 'handlebars'

  - compiler.js:76 
    [wallet-admin]/[html-webpack-plugin]/lib/compiler.js:76:16

  - Compiler.js:214 Compiler.<anonymous>
    [wallet-admin]/[webpack]/lib/Compiler.js:214:10

  - Compiler.js:403 
    [wallet-admin]/[webpack]/lib/Compiler.js:403:12

  - Tapable.js:67 Compiler.next
    [wallet-admin]/[tapable]/lib/Tapable.js:67:11

  - CachePlugin.js:40 Compiler.<anonymous>
    [wallet-admin]/[webpack]/lib/CachePlugin.js:40:4

  - Tapable.js:71 Compiler.applyPluginsAsync
    [wallet-admin]/[tapable]/lib/Tapable.js:71:13

  - Compiler.js:400 Compiler.<anonymous>
    [wallet-admin]/[webpack]/lib/Compiler.js:400:9

Child html-webpack-plugin for "index.html":

    ERROR in Cannot find module 'handlebars'

Not sure what is going on...I've tried changing all versions of: html-webpack-plugin, webpack, handlebars-loader thinking it is a versioning issue. It doesn't seem to be. Any ideas?

like image 602
Matt Goo Avatar asked Aug 30 '16 00:08

Matt Goo


1 Answers

Thankfully I figured out my own issue...in my webpack.config.js file under modules, I had the handlebars loader as:

module: {
  loaders: [
    {
      // this should be /\.handlebars$/
      test: /\.hbs$/,
      exclude: /(node_modules)/,
      loader: 'handlebars-loader'
    }
  ]
}

But for some reason it needed the extension to be .handlebars instead of just .hbs even though my file is a .hbs. One mystery solved, another found. But it works!

like image 153
Matt Goo Avatar answered Nov 15 '22 09:11

Matt Goo