Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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! [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

like image 716
Gulzar Yousaf Avatar asked Mar 13 '19 10:03

Gulzar Yousaf


1 Answers

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 }); 
like image 147
s1mm0t Avatar answered Sep 23 '22 03:09

s1mm0t