How to install Node.js_javascript tips under Mac/windows

Source: Internet
Author: User
Tags openssl install node git clone
Mac

Under a Mac, if you like to use homebrew, then just use one line to install it:

Brew Install node

Otherwise, you can only consider manual installation, as follows:
Install Xcode
Install Git
Run the following command line to compile Node.js
Copy Code code as follows:

git clone git://github.com/ry/node.git
CD node
./configure
Make
sudo make install

Ubuntu
Install Dependency Pack

sudo apt-get install g++ Curl Libssl-dev apache2-utils
sudo apt-get install Git-core

Run the following command line:
Copy Code code as follows:

git clone git://github.com/ry/node.git
CD node
./configure
Make
sudo make install

Windows

To install node with Cygwin, follow these steps:
Install Cygwin
In the Cygwin directory, run setup.exe install the packages in the following list
Devel→openssl
devel→g++-gcc
Devel→make
Python→python
Devel→git
Run Cygwin
Run the following command line:
Copy Code code as follows:

git clone git://github.com/ry/node.git
CD node
./configure
Make
sudo make install

Centos
Copy Code code as follows:

Yum Install gcc-c++ Openssl-devel
wget--no-check-certificate https://github.com/ry/node/tarball/v0.3.3
TAR-XZVF ry-node-v0.3.3-0-g57544ba.tar.gz
CD RY-NODE-V0.3.3-0-G57544BAC1
./configure
Make
Make install

Hello node.js!

Write a small program such as hello_node.js to verify that the installation is correct:
Copy Code code as follows:

var http = require (\ ' http\ ');
Http.createserver (function (req, res) {
Res.writehead ({\ ' content-type\ ': \ ' text/plain\ '});
Res.end (\ ' Hello node.jsn\ ');
}). Listen (8124, "127.0.0.1");
Console.log (\ ' Server running at http://127.0.0.1:8124/\ ');

Use node to run this piece of code
Copy Code code as follows:

Node Hello_node.js
Server running at http://127.0.0.1:8124/

Now, with the browser open http://127.0.0.1:8124/, you should be able to see a piece of good news.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.