samples-js-angular icon indicating copy to clipboard operation
samples-js-angular copied to clipboard

An unhandled exception occurred: listen EACCES: permission denied 127.0.0.1:8080

Open shylendramadda opened this issue 4 years ago • 16 comments

After doing npm install when I run ng serve I am getting this error:

An unhandled exception occurred: listen EACCES: permission denied 127.0.0.1:8080

unable to run the project.

shylendramadda avatar Aug 23 '20 08:08 shylendramadda

EACCESS is a permission from the local system - Usually I see this if I'm running another server (or another instance of the same server) on the same port (8080 in this case).

Unfortunately, how to check your system to see what is already bound to a port will vary depending on your OS, and is a bit outside the scope of the sample docs.

swiftone avatar Aug 24 '20 17:08 swiftone

You can install fkill-cli to kill processes running on a certain port.

npm i -g fkill-cli
fkill :8080

mraible avatar Aug 24 '20 19:08 mraible

You can probably use the --port cli option to serve on a different port. However, you would also need to adjust your login redirect URI to use the same port. https://angular.io/cli/serve

aarongranick-okta avatar Aug 24 '20 19:08 aarongranick-okta

Okay, thanks @swiftone let me check this and let you know.

shylendramadda avatar Aug 25 '20 07:08 shylendramadda

@swiftone Now I stopped my server which is running on the same port 8080. Now I found this error: An unhandled exception occurred: Environment variable ISSUER must be set. See README.md See "C:\Users\myPC\AppData\Local\Temp\ng-LwessF\angular-errors.log" for further details.

I already set the ISSUER and CLIENT_ID in the environment.ts

export const environment = {
  production: false,
  ISSUER: 'https://myoktadomain.com/oauth2/default',
  CLIENT_ID: '0oasgasdhdjhgasjdbgj' // it's a dummy one
};

shylendramadda avatar Aug 25 '20 07:08 shylendramadda

You can install fkill-cli to kill processes running on a certain port.

npm i -g fkill-cli
fkill :8080

I tried this here is the log fkill :8080

? Error killing process. Would you like to use the force? Yes
AggregateError:
    Error: Killing process :8080 failed: Process doesn't exist
        at Array.map (<anonymous>)
        at fkill (C:/Users/shyle/AppData/Roaming/npm/node_modules/fkill-cli/node_modules/fkill/index.js:128:9)
        at async Object.handleFkillError (C:/Users/shyle/AppData/Roaming/npm/node_modules/fkill-cli/interactive.js:125:4)      
    at fkill (C:\Users\shyle\AppData\Roaming\npm\node_modules\fkill-cli\node_modules\fkill\index.js:128:9)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async Object.handleFkillError (C:\Users\shyle\AppData\Roaming\npm\node_modules\fkill-cli\interactive.js:125:4)

shylendramadda avatar Aug 25 '20 07:08 shylendramadda

You can install fkill-cli to kill processes running on a certain port.

npm i -g fkill-cli
fkill :8080

I tried this here is the log fkill :8080

? Error killing process. Would you like to use the force? Yes
AggregateError:
    Error: Killing process :8080 failed: Process doesn't exist
        at Array.map (<anonymous>)
        at fkill (C:/Users/shyle/AppData/Roaming/npm/node_modules/fkill-cli/node_modules/fkill/index.js:128:9)
        at async Object.handleFkillError (C:/Users/shyle/AppData/Roaming/npm/node_modules/fkill-cli/interactive.js:125:4)      
    at fkill (C:\Users\shyle\AppData\Roaming\npm\node_modules\fkill-cli\node_modules\fkill\index.js:128:9)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async Object.handleFkillError (C:\Users\shyle\AppData\Roaming\npm\node_modules\fkill-cli\interactive.js:125:4)

After doing npm install when I run ng serve I am getting this error:

An unhandled exception occurred: listen EACCES: permission denied 127.0.0.1:8080

unable to run the project.

how did you resolve this??

suresh444 avatar Feb 08 '21 14:02 suresh444

I had the same issue I solved this by restarting the Windows NAT

open CMD/PowerShell and type net stop winnat and then net start winnat

TKaluthanthri avatar Aug 24 '21 04:08 TKaluthanthri

Well, Google bring me here. I got the same issue with Vue3 by running. npm run dev

I Solved this by adding a flag '--port 3001' (Which means : use another port by default)

npm run dev --port 3001

Maybe this issue is due that other app is using the same port. Hope you solve it! :smiley: :+1:

francodevarg avatar Feb 28 '22 20:02 francodevarg

please help me out still getting same error after trying all the possible solutuon listed here.

Error: listen EACCES: permission denied 8000;

ChichebeDarlington avatar May 07 '22 10:05 ChichebeDarlington

For anyone coming here in future: I would suggest use command prompt (as admin) and net stop winnat net start winnat This should free up the ports.

SaurabhBose avatar Nov 29 '22 03:11 SaurabhBose

thanks @SaurabhBose it worked for me!

Ibinola avatar Feb 08 '23 12:02 Ibinola

tried every thing which is mentioned above, not working plz help me to get out of this

Karanpal97 avatar Jul 14 '23 09:07 Karanpal97

Me too! T_T

IasmimCristina avatar Jul 17 '23 01:07 IasmimCristina

If my earlier solution of

net stop winnat
net start winnat

did not work:

  1. Are you running the cmd as admin? If not, Right-click on the application or command prompt you're using to start the server and select "Run as administrator".
  2. netstat -ano | findstr :8080 : and try stopping processes binding on that port.

SaurabhBose avatar Jul 17 '23 02:07 SaurabhBose

On Windows System, restarting the service "Host Network Service", resolved the issue.

Original answer: https://stackoverflow.com/a/65434145/12731030

dumindu-dev avatar Mar 30 '24 02:03 dumindu-dev