Articles in this section

Node.js error on Plesk domain: Error: listen EADDRINUSE: address already in use 0.0.0.0:3000

Plesk for Linux kb: technical ext: nodejs

Applicable to:

  • Plesk for Linux

Symptoms

  • While trying to run a Node.js application for a domain by using the Node.js Toolkit extension for Plesk by going to Domains > example.com > Node.js > Run Node.js commands, an error that is similar to the following appears

     

CONFIG_TEXT: next start
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. Error: listen EADDRINUSE: address already in use 0.0.0.0:3000
at Server.setupListenHandle [as _listen2] (node:net:1774:16)
at listenInCluster (node:net:1822:12)
at doListen (node:net:1971:7)
at process.processTicksAndRejections (node:internal/process/task_queues:83:21)

Cause

Port 3000, which your Node.js application is attempting to use is already occupied by a service that the Premium Antivirus for Servers extension for Plesk uses:

# netstat -tulpn | grep :3000
tcp 0 0 127.0.0.1:3000 0.0.0.0:* LISTEN 1331/drwebd.real

Resolution

You can resolve the issue by changing the port that the Premium Antivirus for Servers extension's drweb service uses by doing the following:

1. Log into your server via SSH

2. Back up the Premium Antivirus for Servers extension config files by executing the following commands:

# cp -a /etc/drweb/drweb32.ini{,.back}

# cp -a /etc/drweb/drweb_handler.conf{,.back}

2. Open the /etc/drweb/drweb32.ini and /etc/drweb/drweb_handler.conf configuration files with your favorite command-line text editor

Warning: Updates to Plesk and its extensions may revert the changes that you've made to these configuration files

3. Find the Address line in the /etc/drweb/drweb_handler.conf file and change it to the following:
Note: The contents below change the port on which this service runs to 2999.

Address = inet:2999@localhost

4. Find the Socket line in /etc/drweb/drweb32.ini and change it to the following:

Socket = 2999, localhost

5. Save the changes and close the file

6. Execute the following command in order to restart the Dr.Web daemon:

systemctl restart drwebd.service

 

After this was been done, port 3000 will not be occupied by a service tied to the Premium Antivirus for Servers extension and you may start your own service on that port.
 

Alternative solution

As an alternative to the solution above, you may reconfigure the Node.js app itself to not run on a specific port (such as port 3000) by using the information mentioned in the following article:

Is it possible to change Node.js application port in Plesk?

 

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.