'npm run deploy - not working - npm ERR! code ELIFECYCLE

I am trying to deploy my project to Github pages but npm gives errors. I updated node_module. Even I create new react-app and trying to deploy it gives me same error.

[email protected] predeploy

npm run build

[email protected] build /Users/comp/Desktop/💼WEB/Task
react-scripts build

/Users/comp/Desktop/💼WEB/Task/node_modules/react-scripts/config/webpack.config.js:664
new MiniCssExtractPlugin({
^

TypeError: MiniCssExtractPlugin is not a constructor
at module.exports (/Users/comp/Desktop/💼WEB/Task/node_modules/react-scripts/config/webpack.config.js:664:9)
at Object. (/Users/comp/Desktop/💼WEB/Task/node_modules/react-scripts/scripts/build.js:58:16)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: react-scripts build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/dmitrytsuverkalov/.npm/_logs/2022-02-22T15_25_05_383Z-debug.log


And here is my json file

 "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "predeploy": "npm run build",
    "deploy": "gh-pages -d build"
  },


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source