Home > Web Front-end > JS Tutorial > Nodejs win7 installation method_javascript skills

Nodejs win7 installation method_javascript skills

WBOY
Release: 2016-05-16 17:52:58
Original
1278 people have browsed it

This is just pure construction, there is no environment, and there is no server-side js to play with. Everything has become a cloud. Let us first build an environment and enter a "hello world" page.

Yes, you only need to follow me step by step to set up under win7, and it will be ok. You don’t need to understand too many details. That is not what we need to care about now. Our primary purpose now is to improve the environment. Build it or there will be no next step.

Step 1. Download
node.js needs to be installed under Cygwin under Windows. Go to the Cygwin website to download the Cygwin installation program.

Cygwin website: http://cygwin.com/

Direct download address: http://cygwin.com/setup.exe

Step 2. Install

Install the Cygwin program you downloaded, basically just take the next step.

Select on the Choose A Download Source interface-》install from internet

Select on the Select Your Internet Connection interface-》Direct Connect

Select on the Choose A Download Site interface-》 This is your choice, just choose the downloaded image. It is recommended to use the Japanese website ending with .jp, which is faster

Note: If you are installing it for the first time, a warning may pop up. Just ignore it and click OK. Can.

Step 3. Select the installation component

Note: Since there are many components, it is recommended to use search to find them. Click on the name to select it. After selecting, there will be a small square with an X (cross) inside to indicate selection.

Devel Category
gcc-g : C compiler
gcc-mingw-g : Mingw32 support headers and libraries for GCC C
gcc4-g : G subpackage
git: Fast Version Control System – core files
make: The GNU version of the 'make' utility
openssl-devel: The OpenSSL development environment
pkg-config: A utility used to retrieve information about installed libraries
zlib -devel: The zlib compression/decompression library (development)

Editor Category
vim: Vi IMproved – enhanced vi editor

Python Category
All
Note: All are safe ?, you just need to click the icon on the right side of Python to switch to Install.

Web Category
wget: Utility to retrieve files from the WWW via HTTP and FTP
curl: Multi-protocol file transfer command-line tool

You will be prompted after the next step There are many dependent components that need to be installed. Basically, just click Next.
Note: Since the components are all downloaded online, it may take a long time, just wait.

Step 4. Run ash.exe

After installation, an icon will be generated on the desktop (if you selected the Generate icon on the desktop item), be careful not to run this icon!

Open the folder and enter the C:cygwinbin directory. This is the default installation directory. If you have modified the installation directory, enter the bin directory under the cygwin installation directory.

Run ash.exe

Execute the ./rebaseall -v command in the pop-up command window

Wait until the command execution is completed, execute exit and exit ash

Step 5. Download and install Node.js

Run the Cygwin program on the desktop.

Enter wget http://nodejs.org/dist/node-v0.4.7.tar.gz in the command window and press Enter.

Note: I am writing this article because the latest version of node.js is node-v0.4.7, http://nodejs.org/dist/node-v0.4.7.tar.gz is node. js download address, when you read this article, you can go to the node.js website to get the latest download path and replace it

Node.js website: http://nodejs.org/

Input tar xf node-v0.4.7.tar.gz in the command window and press Enter. node-v0.4.7.tar.gz is the version you downloaded.

Input cd node-v0.4.7 in the command window and press Enter.

Enter ./configure in the command window and press Enter.

Enter make in the command window and press Enter.

Input make install in the command window and press Enter.

ok, now you have installed node.js.

Enter node –version in the command window and press Enter to see your node.js version.

Step 6. Set DNS
Open the folder and go to the C:cygwinetc folder.

Create the resolv.conf file manually.

Open the newly created resolv.conf file with Notepad and add the following

nameserver 8.8.8.8
nameserver 8.8.4.4
Save and close.

Step End. Test whether Node.js can run

At this point you have completed the setup, but you don’t know if it can run correctly. So, let’s write a sample file. Test it.

Create example.js in the C:cygwin directory

Enter
var http = require('http');

http.createServer(function (request, response) {
response.writeHead(200, {'Content-Type': 'text/html'});
response.end('Hello World');
} ).listen(8888);

console.log('Server running at http://127.0.0.1:8888/');

Save (Note: Save in UTF-8 format , otherwise a syntax error will be reported).


Run cygwin, enter node /example.js in the command window and press Enter

Do you see Server running at http://127.0.0.1:8888/

Don’t close cygwin, open the browser and visit http://127.0.0.1:8888/ to see if the hello world page appears.

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