Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

Sorry, you do not have permission to ask a question, You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please type your username.

Please type your E-Mail.

Please choose an appropriate title for the post.

Please choose the appropriate section so your post can be easily searched.

Please choose suitable Keywords Ex: post, video.

Browse

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Logo Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Logo

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Navigation

  • Home
  • About Us
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • About Us
  • Contact Us
Home/ Questions/Q 3410

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Latest Questions

Author
  • 61k
Author
Asked: November 26, 20242024-11-26T02:28:08+00:00 2024-11-26T02:28:08+00:00

How to Kill a Process Running on a Port

  • 61k

It is common in Node.js and other languages to run a script on a certain port. Since ports can come in and out of use, it's also common to get the following error:

    Error: listen EADDRINUSE: address already in use :::3000     at Server.setupListenHandle [as _listen2] (net.js:1318:16)     at listenInCluster (net.js:1366:12)     at Server.listen (net.js:1452:7)     at Function.listen (/application.js:618:24)     at file:///httpdocs/index.js:149:5     Emitted 'error' event on Server instance at:         at emitErrorNT (net.js:1345:8)         at processTicksAndRejections (internal/process/task_queues.js:80:21) {         code: 'EADDRINUSE',         errno: -98,         syscall: 'listen',         address: '::',         port: 3000     } 
Enter fullscreen mode Exit fullscreen mode

This error says that there is currenlty something running on port 3000, so we can't use it. Fortunately this is quite easy to fix.

Linux and Mac

To solve this issue on linux or on a mac, you first want to find out the process ID or PID currently running on the port (in our case :3000). To do that, you can use lsof. If you want a way to remember lsof, it is that it means 'list of'.

    lsof -i :3000 
Enter fullscreen mode Exit fullscreen mode

This will return processes running on port :3000. The next step is to kill the processes on that port. Note the PID, and then run the following command, replacing [PID] with your PID:

    kill -15 [PID] 
Enter fullscreen mode Exit fullscreen mode

Why -15? -15 refers to the message your computer will send. You should try -15 the first time, as this will lead to an orderly shutdown of port 3000. If that doesn't work, then try:

    kill -9 [PID] 
Enter fullscreen mode Exit fullscreen mode

Now there will be nothing running on port :3000. This will also work for any other port you're having issues with, i.e. :8080, :1337, or any other number.

For Windows Users

For any windows users out there, it is slightly different, but I have put this here as it may also prove useful. First off, find what is running at the port you are looking for (i.e. 3000). The PID can be found at the end of the line when you run this process:

    netstat -ano | findstr :3000 
Enter fullscreen mode Exit fullscreen mode

Then, similar to linux and mac, kill what is on that port, replacing PID with the PID for that process from the statement above.

     taskkill /PID PID /F 

javascriptlinuxtutorialwebdev
  • 0 0 Answers
  • 3 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

Sidebar

Ask A Question

Stats

  • Questions 4k
  • Answers 0
  • Best Answers 0
  • Users 2k
  • Popular
  • Answers
  • Author

    ES6 - A beginners guide - Template Literals

    • 0 Answers
  • Author

    Understanding Higher Order Functions in JavaScript.

    • 0 Answers
  • Author

    Build a custom video chat app with Daily and Vue.js

    • 0 Answers

Top Members

Samantha Carter

Samantha Carter

  • 0 Questions
  • 20 Points
Begginer
Ella Lewis

Ella Lewis

  • 0 Questions
  • 20 Points
Begginer
Isaac Anderson

Isaac Anderson

  • 0 Questions
  • 20 Points
Begginer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help

Footer

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise

Querify Question Shop: Explore, ask, and connect. Join our vibrant Q&A community today!

About Us

  • About Us
  • Contact Us
  • All Users

Legal Stuff

  • Terms of Use
  • Privacy Policy
  • Cookie Policy

Help

  • Knowledge Base
  • Support

Follow

© 2022 Querify Question. All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.