Simply put, Node.js is the JavaScript that runs on the server side.
Node.js is a platform built on the Chrome JavaScript runtime.
Node.js is an event-driven I/O server-side JavaScript environment, based on Google's V8 engine, the V8 engine executes JavaScript very quickly and performs very well.
Who is the right person to read this tutorial?
If you're a front-end programmer, you don't know a dynamic programming language like PHP, Python, or Java, and then you want to create your own service, then Node.js is a great choice.
Node.js is a JavaScript that runs on the server side, and if you are familiar with JavaScript, you will easily learn to Node.js.
Of course, if you are a backend programmer and want to deploy some high-performance services, then learning Node.js is also a great choice.
Before you learn this tutorial, you need to understand
Before continuing this tutorial, you should know some basic computer programming terminology. If you have studied programming languages such as Javascript,php,java, it will help you understand node.js programming faster.
Node.js Installation and Configuration
Here, I'll show you how to install Node.js on Windows and Linux. The Software Installation version takes 0.12.0 as an example.
Node.js Official installation package and source code download address: http://nodejs.org/download/
Depending on the platform, you need to select the Node.js installation package you want.
Note: Installing Node.js on Linux requires the installation of Python 2.6 or 2.7, and it is not recommended to install Python version 3.0 or above.
Install Node.js on Windows
Windows Installer package (. msi):
Download from the official download address provided above.
Demo Environment:
Operating system: Windows 8.1 Enterprise x64
Node.js Version: 0.12.0
Installation steps:
Step 1: Double-click the download installation package "Node-v0.12.0-x64.msi" to display the Welcome interface as follows:
Step 2: Click Next to display the Node.js License Agreement page:
Step 3: Check "I accept the terms in the License agreement" agree to the license agreement, and click Next Next, the following interface appears:
Step 4:node.js The default installation path is "C:\Program files\nodejs\", you can modify, here I changed to D disk, click Next, the installation mode and module selection interface appears:
Step 5: Here I direct default next next, ready to install:
Step 6: After the confirmation is correct, click Install to start the installation:
Step 7: After half a minute, the installation is complete, click Finish to:
Step 8: Configure Environment variables:
By default, Node.js is installed, the Node.exe directory path is automatically configured in the system's PATH environment variable, but you may be able to enter a Node prompt error under the DOS command after your installation is complete.
Open the System environment variable, found that it has been configured, but DOS run "set path" and can not see the Nodejs configuration, that is the problem of personality. Reboot the computer to reload it.
You can also delete the automatic configuration, manually plus can be. As follows:
Open the computer Properties-advanced-environment variable, and locate the path variable in the system variables list:
Click "Edit" to add the Nodejs installation directory at the end:
Step 9: Detect if the installation was successful:
Click Start-Run-cmd, open dos, enter "Node--version" Check Node.js version:
If the normal display, then OK, installation complete!
Install Node.js on Linux
Ubuntu Source Installation
In the following sections we will describe installing Node.js under Ubuntu Linux. Other Linux systems, such as CentOS, are similar to the following installation steps.
Github on the acquisition of Node.js source code, you can also go to the official website download:
After the download is complete, change the source package name to ' node '.
To modify directory permissions:
Use './configure ' to create a compiled file.
Compile: Make.
Complete installation: Make install.
Finally, we enter the ' node--version ' command to see if the Node.js is successfully installed.
Ubuntu apt-get Command Installation
The command format is as follows:
Copy Code code as follows:
sudo apt-get install Nodejs
sudo apt-get install NPM
Install Nodejs under CentOS
1, download the source code , you need to download the latest Nodejs version in http://nodejs.org/, this article take v0.12.0 as an example:
Copy Code code as follows:
cd/usr/local/src/
wget http://nodejs.org/dist/v0.12.0/node-v0.12.0.tar.gz
2, Decompression Source:
Copy Code code as follows:
Tar zxvf node-v0.12.0.tar.gz
3. Compile and install:
Copy Code code as follows:
CD node-v0.12.0
./configure--prefix=/usr/local/node/0.12.0
Make
Make install
4, configure Node_home, enter profile edit environment variable:
Copy Code code as follows:
Set the NODEJS environment variable to add the following on the export PATH USER LOGNAME MAIL HOSTNAME histsize histcontrol Line:
Copy Code code as follows:
#set for Nodejs
Export node_home=/usr/local/node/0.12.0
Export path= $NODE _home/bin: $PATH
: Wq Save and exit, compile/etc/profile to make configuration effective
Copy Code code as follows:
Verify that the configuration was successfully installed
Copy Code code as follows:
The output v0.12.0 indicates a successful configuration.
NPM Module Installation Path
Copy Code code as follows:
/usr/local/node/0.12.0/lib/node_modules/
The above is the article about Node.js, installation and configuration of the full content of the follow-up we will continue to update this series, I hope that we can help.