Configuration of the Nodejs development environment:
Just started to learn mainly on Mac, so temporarily only recorded on their own Mac learning experience;
One: Installation
1: Download node's operating environment from official website
https://nodejs.org/
2: Double-click the pkg file installation, the general node itself will be in the environment variables to add their own;
After installation, you can see
Two: Test,
1: Open terminal input node-v,
You can see the following version information, indicating that the installation is OK.
2: Install a debug tool: Supervisor
sudo npm install-g Supervisor
Three: a small demo
1: New nodedemo.js, Content:
Console.log ("Hellow Node js!");
2: In the terminal CD to the directory where the Nodedemo.js is located, and execute:
Node Nodedemo.js
Immediately after the terminal output: Hellow Node js!
3: It means everything is installed successfully!
Four: can also use: Supervisor start JS Application;
For example: in the terminal
Supervisor Nodedemo.js
The advantage of using supervisor is that the modified code can be refreshed dynamically without stopping the service;
Test examples in the next section
Configuration of the 1:nodejs development environment