How to install node.js on server?


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, 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.

Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @cemMantaRay,

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

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