It is quite common to come across this error while using webpack on windows environment for the first time. It is a path related error and the fix is quite simple.
I am assuming that you are using node packet manager (npm) to install webpack. Just add -g parameter while installing webpack. So the command will look like
npm install -g webpack --save-dev
You will also need to install webpack-cli ( if you are using webpack 4+)
npm install -g webpack-cli --save-dev
Thats it! Now you can use webpack in command line.
Did this solution work for you? Let me know in the comments below.