Failed to compile. webpack is not a function

a 夏天 提交于 2020-08-22 07:29:06

问题


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


回答1:


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



回答2:


Simple npm install command worked form me



来源:https://stackoverflow.com/questions/55140033/failed-to-compile-webpack-is-not-a-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!