Nodejs installation and environment configuration in WIN system

Step 1: Download the installation file to download nodeJS. The official website is nodejs.org/download/. Here I download node-v0.10.28-x86.msi.

Step 2: Install NodeJS
Step 3: NPM installation

Step 4: Install the environment

npm install express -g 
npm install jade -g
npm install mysql -g
Copy the code

By default, the above components are installed in the D: dev nodejsnode_modules folder, which is also the automatic lookup path for nodejs-related components.

Step 5: Install CoffeeScript

npm install coffee-script -g
Copy the code

Run the coffee -v command to confirm the installation. If the version number appears, the installation is successful.

Step 6: Create a new cs.js file for the CoffeeScript test instance and type:

for i in [0...5]
console.log "hello #{i}"
Copy the code

Run “coffee cs.js” in this directory:

D:\>coffee cs.js
hello 0
hello 1
hello 2
hello 3
hello 4
Copy the code

The above environment is basically configured. Note: all commands are installed globally by -g, so that the installed installation package is under the current user, all other places on the disk can be accessed, compare aspects. Otherwise, it can be used only in the current directory.

Error In Express installation After nodeJS installation package is installed and Express is installed through NPM, a message indicating that “Express” is not an internal or external command is displayed when express is run. The current version is 4.0.0.

$NPM install -g [email protected]Copy the code

The global installation is in the C: Users\ XDSKG \AppData\Roaming\ NPM directory.

NodeJs peripheral tools:

NodeJs has a lot of tools on Github, so how to organize them is a problem. The first step is to clarify what these tools or libraries are for, what problems they solve, and how to use them.

● NPM: NodeJs package manager

● Express: a popular MVC framework on the server side, handling service requests, routing and forwarding, and logic processing

● Mongoose: mongodb packaging, more convenient to use the database

● Socket. IO: server and client socket communication solution

● Backbone: CLIENT-side MVC framework, write client-side applications (Douban said)

● Coffeescript: Improves JavaScript readability and robustness

● Zombie: Browser subset, write HTML parser, lightweight javascript client test