'webpack dev server error after npx create-react-app

I run npx create-react-app and when I start it I get the error: Module not found:

Error: Can't resolve 'D:#MyCode\React\playground\node_modules\webpack-dev-server\client\index.js?protocol=ws%3A&hostname=0.0.0.0&port=3000&pathname=%2Fws&logging=none&reconnect=10' in 'D:#MyCode\React\playground'

How can I fix this? All my previous projects that build with create-react-app also have this error. I tried to delete and re-install node_modules. I deleted webpack-dev-server globally and reinstall it. Still I have this error everywhere. Only projects with custom webpack config still work.



Solution 1:[1]

i also had this error. I simply terminated the project by pressing Ctrl+C then Y to confirm, and reloaded with npm start.

also if you type

npm fix audit --force

and then as it is updating make sure it updates react-scripts to 5.0^ then it should work. make sure you aren't running your project when updating this.

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 DharmanBot