Report this

What is the reason for this report?

How to install node.js on server?

Posted on June 14, 2020

Hi,

I am really new to servers and I stucked on somewhere. I looked for this for hours but i could not find the solution.

I have a simple node.js app for a chat app. I created a CentOS droplet and installed node.js, NPM, socket.io and pm2 in it. My sockets were running just fine but I could not be able to POST some data to my node.js app. What should I do to install the node.js on a droplet properly? Why I could not be able to POST data? It seemed weird to me because my app was running, I was able to use de sockets but it was not receiving POST data.

Also I tried the node.js on Ubuntu from Marketplace but I coulnd find out how to use it, I couldn’t even figure out how to run my app. And by the way, my app is running all fine in my local Windows.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi @cemMantaRay,

Firstly, I would recommend checking out this article right here :

https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-centos-8

You’ve most probably checked it however in case you haven’t give it a try.

Now to the problem you’ve mentioned. Are you sure you’ve used the proper port? Usually, when you open a website on the browser it either uses 80 or 443 by default. As far as I know usually nodejs apps use different ports. Maybe that’s your issue right here.

In order to check which port uses your nodejs app, you can check or configuration file or once you’ve started nodejs, type in the following command on your droplet

netstat -tulpen

This will show which ports are being used. Now that you know the port, try to POST data to your app.

Regards, KDSys

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.