'Need to install 'webpack-dev-server'

I have cloned a repo from GitHub for a project. I've already installed node (-v 14.17.5) and npm (-v7.20.6), however when I run npm start I get the following code. I've tried reinstalling node and npm several times but I keep getting the same error:

$ npm start

> [email protected] start
> webpack server --config webpack.dev.js --open

[webpack-cli] You need to install 'webpack-dev-server' for running 'webpack serve'.
Error: Cannot find module 'webpack-dev-server/bin/cli-flags'
Require stack:
- C:\Users\edwin\Desktop\git\simplefolio\node_modules\@webpack-cli\serve\lib\index.js
- C:\Users\edwin\Desktop\git\simplefolio\node_modules\webpack-cli\lib\webpack-cli.js
- C:\Users\edwin\Desktop\git\simplefolio\node_modules\webpack-cli\lib\bootstrap.js
- C:\Users\edwin\Desktop\git\simplefolio\node_modules\webpack-cli\bin\cli.js
- C:\Users\edwin\Desktop\git\simplefolio\node_modules\webpack\bin\webpack.js


Solution 1:[1]

Remove node modules, then npm i again

Solution 2:[2]

In my case, I have node 16.13.0 and npm 7.20.1. Removing nodes_modules, package-lock.json and run npm cache clean --force alone didn't help. The key change for me is upgrading npm version to the latest (8.7.0), then combining with clean install.

Solution 3:[3]

Remove node_modules and package-lock.json, then npm i again

Sources

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

Source: Stack Overflow

Solution Source
Solution 1 Tomerikoo
Solution 2 Tng
Solution 3 Tyler2P