webpack is not recognized as a internal or external command,operable program or batch file

Better solution to this problem is to install Webpack globally.

This always works and it worked for me. Try below command.

npm install -g webpack

As an alternative, if you have Webpack installed locally, you can explicitly specify where Command Prompt should look to find it, like so:

node_modules\.bin\webpack

(This does assume that you're inside the directory with your package.json and that you've already run npm install webpack.)


I had this issue for a long time too. (webpack installed globally etc. but still not recognized) It turned out that I haven't specified enviroment variable for npm (where is file webpack.cmd sitting) So I add to my Path variable

%USERPROFILE%\AppData\Roaming\npm\

If you are using Powershell, you can type the following command to effectively add to your path :

[Environment]::SetEnvironmentVariable("Path", "$env:Path;%USERPROFILE%\AppData\Roaming\npm\", "User")

IMPORTANT : Don't forget to close and re-open your powershell window in order to apply this.

Hope it helps.

Tags:

Npm

Webpack