Mini-css-extract-plugin: [webpack-contrib/mini-css-extract-plugin] TypeError: Cannot destructure property `createHash` of 'undefined' or 'null'

Created on 3 Apr 2018  Â·  12Comments  Â·  Source: webpack-contrib/mini-css-extract-plugin

I am using webpack 4.1.1.

I tried 'npm install [email protected]' but still I am getting

npm WARN [email protected] requires a peer of buble@* but none is
installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of node-sass@^4.0.0 but none is
installed. You must install peer dependencies yourself.

I tried nom cache clear --force. Then tried install web pack 4.4.1.

Nothing is working. Do anyone know how to upgrade my webpack?

Most helpful comment

  1. Make sure your configuration matches the one in README
  2. Remove your node_modules
  3. Update webpack version in package.json
  4. Run npm install

Updating from [email protected] to [email protected] fixed it for me

All 12 comments

@bspatil0001 can you create minimum reproducible test repo? Looks you don't have [email protected]

I tried 'npm install [email protected]' but still I am getting

npm WARN [email protected] requires a peer of buble@* but none is
installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of node-sass@^4.0.0 but none is
installed. You must install peer dependencies yourself.

I tried nom cache clear --force. Then tried install web pack 4.4.1.

Nothing is working. Do you know how to upgrade my webpack.

Thank You,

With Regards,
Basavanagouda.S.Patil

On Tue, Apr 3, 2018 at 3:01 PM, Evilebot Tnawi notifications@github.com
wrote:

@bspatil0001 https://github.com/bspatil0001 can you create minimum
reproducible test repo? Looks you don't have [email protected]

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/webpack-contrib/mini-css-extract-plugin/issues/80#issuecomment-378188476,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AJzQBacMo-P1N0kO-LFqKyAbxYiLqjAZks5tk0FdgaJpZM4TEhgV
.

I'm having the same issue (also using Webpack 4.4.1).

When I upgraded to webpack version 4.4.1 it fixed the problem for me.

Here is my prod configuration:

{
                test: /\.scss$/,
                use: [{
                    loader: MiniCssExtractPlugin.loader,
                }, {
                    loader: 'css-loader',
                    options: {
                        minimize: true
                    }
                }, {
                    loader: 'sass-loader'
                }]
            }

and

new MiniCssExtractPlugin({
    filename: '[name].[contenthash].css'
})

I tried to upgrade my webpack, but it it not getting updated my webpack. I
have my test repo, friend npm install [email protected], but in vain. I have
given msgs I am getting when I tried to upgrade webpack.

On Tue 3 Apr, 2018, 8:54 PM Gwendolyn Faraday, notifications@github.com
wrote:

When I upgraded to webpack version 4.4.1 it fixed the problem for me.

Here is my prod configuration:

{
test: /.scss$/,
use: [{
loader: MiniCssExtractPlugin.loader,
}, {
loader: 'css-loader',
options: {
minimize: true
}
}, {
loader: 'sass-loader'
}]
}

and

new MiniCssExtractPlugin({
filename: 'bundle.[contenthash].css'
})

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/webpack-contrib/mini-css-extract-plugin/issues/80#issuecomment-378289615,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AJzQBTXeHP7OZtOQV1ebA0uLsoA9uuapks5tk5QcgaJpZM4TEhgV
.

Have you tried remove . your node_modules directory and run npm again?

I have the same issue using Webpack 4.6.0

Just ensure you update webpack to latest version. npm/yarn cache clear -- forece && npm/yarn install, also check you can install webpack globally. Thanks!

Hey guys, I got same error here. I am on latest webpack and mini-css-extract-plugin. used @gwenf code to config and I still have same err:

TypeError: Cannot destructure property `createHash` of 'undefined' or 'null'.
    at Object.<anonymous> (/.../mini-css-extract-plugin/dist/index.js:26:44)
    at Module._compile (module.js:649:30)
    at Object.Module._extensions..js (module.js:660:10)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:501:12)
    at Function.Module._load (module.js:493:3)
    at Module.require (module.js:593:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/.../mini-css-extract-plugin/dist/cjs.js:3:18)
    at Module._compile (module.js:649:30)
npm ERR! code ELIFECYCLE
npm ERR! errno 1

@krso92 because you don't have latest version or you use global installed webpack

  1. Make sure your configuration matches the one in README
  2. Remove your node_modules
  3. Update webpack version in package.json
  4. Run npm install

Updating from [email protected] to [email protected] fixed it for me

Was this page helpful?
0 / 5 - 0 ratings

Related issues

weoil picture weoil  Â·  3Comments

dmitrybelyakov picture dmitrybelyakov  Â·  3Comments

mike-marcacci picture mike-marcacci  Â·  4Comments

skrobek picture skrobek  Â·  4Comments

ripperdoc picture ripperdoc  Â·  3Comments