In this post we detail how to install node on Mac, Ubuntu,
and Windows.
install node with one command:
Otherwise, follow the below steps:
Thanks to code-diesel for the Ubuntu dependencies.
follow these steps:
see the GitHub wiki page.
correctly:
you should see a nice message.
and Windows.
Mac
If you're using homebrew package manager, you caninstall node with one command:
brew install node
.Otherwise, follow the below steps:
- Install Xcode.
- Install git.
- Run the following commands:
darwin_setup.sh
You can check it worked with a simple Hello, World! example.git clone git://github.com/ry/node.git
cd node./configure
make
sudo make install
Ubuntu
-
Install the dependencies:
sudo apt-get install g++ curl libssl-dev apache2-utils
sudo apt-get install git-core
-
Run the following commands:
ubuntu_setup.sh
You can check it worked with a simple Hello, World! example.git clone git://github.com/ry/node.git
cd node./configure
make
sudo make install
Thanks to code-diesel for the Ubuntu dependencies.
Windows
Currently, you must use cygwin to install node. To do so,follow these steps:
- Install cygwin.
-
Use
setup.exe
in the cygwin folder to install the following
packages:
- devel → openssl
- devel → g++-gcc
- devel → make
- python → python
- devel → git
-
Open the cygwin command line with
Start > Cygwin > Cygwin Bash Shell
.
- Run the below commands to download and build node.
cygwin_setup.sh
For more details, including information on troubleshooting, pleasegit clone git://github.com/ry/node.git
cd node./configure
make
sudo make install
see the GitHub wiki page.
Hello Node.js!
Here's a quick program to make sure everything is up and runningcorrectly:
hello_node.js
Run the code with the var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello Node.js\n');
}).listen(8124, "127.0.0.1");
console.log('Server running at http://127.0.0.1:8124/');
node
command line utility:> node hello_node.jsServer running at http://127.0.0.1:8124/
Now, if you navigate to http://127.0.0.1:8124/ in your browser,you should see a nice message.
Congrats!
You've installed node.js.
Thanks To suraj for this blog post
ReplyDelete