reactjsnpmnpm-start

Failed to compile. webpack is not a function


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! project@0.1.0 start: `node scripts/start.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the project@0.1.0 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


Solution

  • 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 });