webpack-bundle-analyzer is not working

As commands should be added to the PATH before it can be called from terminal/shell. So after I try to install the package into global, I can use it:

npm i -g webpack-bundle-analyzer

I think by adding the directory you install the package locally to the PATH will fix the problem too.


If you have npm >5.2 installed, a new utility, npx should already be available
Execute npx webpack-bundle-analyzer dist/stats.json

else you can add a new npm script that calls webpack-bundle-analyzer add this in your package.json

"scripts": {
  "stats": "webpack-bundle-analyzer dist/stats.json",

},

Execute npm run stats