Home > Web Front-end > JS Tutorial > body text

How to install Node.js on Ubuntu 11.10_javascript tips

WBOY
Release: 2016-05-16 17:59:04
Original
2315 people have browsed it

1. Install dependency packages

Copy code The code is as follows:

sudo apt-get install g curl libssl-dev apache2-utils
sudo apt-get install git-core

2. Download source code
Copy code The code is as follows:

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

This step is due to poor network conditions The error keeps showing Cloning to node...
You can download the source code directly from the official website and unzip it to the folder of your account.
The file name was changed to node.
3. Compile
Three commands:
Copy code The code is as follows:

./configure
make
sudo make install

Screenshot after successful installation:

4. Test
Write the following small program, name it example.js, and save it in the node folder.
Copy code The code is as follows:

var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'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:

For the convenience of application, you should also set environment variables, install npm, and other tasks later, right?
Just got it, need to learn more...
The annoying confidentiality check, sorting out the information...

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template