Home > Net >  "Server start failed on port 9876: Error: EACCES: permission denied" on 'ng test'
"Server start failed on port 9876: Error: EACCES: permission denied" on 'ng test'

Time:03-01

Whilst running my Unit Tests in watch mode, Chrome suddenly quit and I now can no longer run 'ng test'. This randomly occurred, and has not happened in over a year of working on these tests.

The error I am getting is:

Server start failed on port 9876: Error: EACCES: permission denied

I am running on a Mac, and have tried restarting both VSCode and my laptop multiple times. There is little to no documentation that I could find on the internet that describes my issue.

My question: Why am I getting this error and how do I fix it? Otherwise, how can I go about finding out more information about this issue by looking at the port usages and how I could go about resting them or similar.

Thanks in Advance!

CodePudding user response:

This was fixed by removing ./node_modules using:

sudo rm -r node_modules

and then re-installed using:

npm install

CodePudding user response:

May be you need to uninstall node modules and reinstall them to fix the issue. Please try to execute in super user mode(root user) like this

sudo rm -r node_modules

You may also need to re-install using:

sudo npm install

Use this command to run Unit Tests in watch mode

ng t --code-coverage --watch --browsers Chrome
  • Related