Failed to compile. webpack is not a function

Gulzar Yousaf picture Gulzar Yousaf · Mar 13, 2019 · Viewed 11.5k times · Source

My project was working fine but after installing react-redux and redux i can't start the project it shows me this error

Failed to compile.

webpack is not a function

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node scripts/start.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

The screenshot of error in ternimal

Answer

s1mm0t picture s1mm0t · Mar 14, 2019

I ran into a problem with this same symptom after upgrading all of my node modules including react and redux, but in particular react-dev-utils to v8.0.0. The createCompiler() function has been changed to expect an object rather than multiple parameters (I guess this will provide greater flexibility in the future).

I changed my start.js from:

const compiler = createCompiler(webpack, config, appName, urls, useYarn);

to:

const compiler = createCompiler({ webpack, config, appName, urls, useYarn });