Search code examples
angularwebpackwebpack-bundle-analyzer

Webpack Bundle Analyzer gives error EACCES


I just found out about webpack bundle analyzer through this link and went to try it out. I was able to run the build and get a stats.json file, however when I run:

webpack-bundle-analyzer dist/RDPortal/stats.json

I get this error:

events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: listen EACCES 127.0.0.1:8888
    at Object._errnoException (util.js:1022:11)
    at _exceptionWithHostPort (util.js:1044:20)
    at Server.setupListenHandle [as _listen2] (net.js:1350:19)
    at listenInCluster (net.js:1408:12)
    at doListen (net.js:1517:7)
    at _combinedTickCallback (internal/process/next_tick.js:141:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
    at Function.Module.runMain (module.js:695:11)
    at startup (bootstrap_node.js:188:16)
    at bootstrap_node.js:609:3

I tried googling the error and webpack bundle analyzer, etc. but couldn't find anything significant that helped. I'm building from the WebStorm IDE in an Angular project and as mentioned the stats.json generates fine (32mb, holy cow).

I did also run the install as npm i webpack-bundle-analyzer in case that matters...

Any help would be most appreciated.


Solution

  • This usually means port is already in use.. You need to kill the program using the above mentioned port.

    As you are using Windows 10 x64, perform the following activities

    In command prompt type following

    1. netstat -aon | findstr 8888 <-- to find pid of application running on '8888'
    2. taskkill /F /PID pid_number <--- to kill application