Ubuntu 11.10 How to install node.js _javascript tips

Source: Internet
Author: User
1. Install Dependency Pack
Copy Code code as follows:

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

2. Download source code
Copy Code code as follows:

git clone git://github.com/ry/node.git

This step is due to poor network condition has been shown cloning to node ...
Can download the source code directly from the official net, unzip to the account folder.
The file name was changed to node.
3. Compile
Three sentences:
Copy Code code as follows:

./configure
Make
sudo make install

Screenshot after successful installation:

4. Test
Write the following applet, named Example.js, saved in the node folder.
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/');

Execute the following command:

Run Result:

After the application is convenient, you should also set up environment variables, install NPM, such as work?
Just start, still need further study ...
Annoying confidential inspection, the collation of information to the ...

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.