Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

installing node js on web server [closed]

I made simple chat application with node.js and socket.io It's working in localhost:3000

But, I want to put it on my own website. I don't know how to install node.js package on web server. I am having mac.

Do you have any idea, how to do it?

like image 812
Ronak Patel Avatar asked Oct 31 '13 01:10

Ronak Patel


People also ask

How do I run node js app forever when console is closed?

js application locally after closing the terminal or Application, to run the nodeJS application permanently. We use NPM modules such as forever or PM2 to ensure that a given script runs continuously. NPM is a Default Package manager for Node.

Does NodeJS need to be installed on the server?

You can run the Node. js application directly from shell, however in order to make sure that it survives server restarts and potential crashes, it should be installed as a service.

Can NodeJS run on a web server?

Install the http-server globally on your machine using the node package manager (npm) command line tool, this will allow you to run a web server from anywhere on your computer.

Do I need to restart my computer after installing Node js?

Yes. Modules are cached on first require, if you use a module that gets updated when running npm install , the running process will keep using the cached version.


2 Answers

Grab the tarball from http://nodejs.org/download/, untar it tar -xzf to some directory, and then run it.

Or use a package manager as described here.

So as an example assuming you grabbed the latest 64-bit vers...

# go to a location where you'll install node
mkdir -p /app/nodejs
cd /app/nodejs
tar -xzf /path/to/node-v0.10.21-linux-x64.tar.gz

At this point, nodejs is in /app/nodejs/node-v0.10.21-linux-x64

Add the bin directory to your PATH (you can edit your ~/.bash_profile or some other init script - for now this will just be for the shell session:

export PATH=$PATH:/app/nodejs/node-v0.10.21-linux-x64/bin`

Now you should be able to do npm install and the like. It sounds like you may need to familiarize yourself with Linux basics - everyone needs to learn somewhere/sometime - I suggest you google around for a good tutorial that suits you.

like image 179
NG. Avatar answered Nov 07 '22 05:11

NG.


http://nodejs.org/download/ Go there. Download it. Put the downloaded folder somewhere near your web pages and just reference it on your page.

You will reference on your page with something like this but instead of https link to google it will be a file path to where the folder is

Where the squiggle is could be different depending on where you place that folder. You shouldn't have to run any commands on it after it is downloaded

like image 28
Nighthawk Avatar answered Nov 07 '22 03:11

Nighthawk