Win7 to build node+npm+bower environment

Source: Internet
Author: User

Address of the original: https://my.oschina.net/JeeChou/blog/219699

Nodejs installation under Windows is convenient (after v0.6.0 version, support Windows native), only need to login the official website (http://nodejs.org/), you can see the homepage of the "Install" button, A direct click will automatically download the installation. The installation process is basically direct "NEXT" on it. (The installation MSI file for Windows will add the system variable of path directly in the process, the variable value is your installation path, for example "C:\Program Files\nodejs", my demo here is installed in "D:\Program Files\nodejs")

Don't say much nonsense, after the installation is complete, we first detect if the Nodejs is installed successfully, cmd command line type:

Node-v

If a version prompt appears, the installation is successful, such as:

  

The installation of NPM. Since NPM has been integrated with the new version of Nodejs, NPM has been installed as well. You can also use the cmd command line to type:

Npm-v

Similarly, if a version prompt appears, the installation is successful, such as:

  

In this way, the construction of the conventional Nodejs has been completed so far, so you can type "node" in the cmd command line to enter node development mode, enter your Nodejs first sentence: "Hello World"-Input: Console.log (' Hello World '). There are no more demonstrations here.

NPM as a Nodejs module management, I did not look at the data in a systematic way, resulting in the installation of the configuration module took a long detour, so it is necessary to list to record. We will first configure the NPM Global Module storage path and the cache path, for example, I would like to put the above two folders in the Nodejs home directory, the Nodejs under the establishment of "Node_global" and "Node_cache" two folder. We'll just type two lines of command in CMD:

Set " D:\Program Files\nodejs\node_global "  Set"D:\Program files\nodejs\node_cache"

Please note, because I have previously dropped Nodejs installed in the "D:\Program Files\nodejs" directory, so when you type the command, please enter your Nodejs directory correctly.

Now let's try to install a module and choose Express, the more commonly used module. Also on the cmd command line, enter:

NPM Install Express-g

Note that the "-G" parameter here means that it is loaded into the global directory, which is the "D:\Program Files\nodejs\node_global" that is said to be set above. After the installation process in the CMD is finished scrolling, it will prompt "express" where it is installed, the version and its directory structure.

The next step is critical, and we need to set up system variables. Go to my Computer → properties → advanced → environment variables. Under System variables, create a new "Node_path" and enter "D:\Program Files\nodejs\node_global\node_global". As shown in the following:

  

If the above steps are OK, we can open the cmd command line again, type:

Node

After the ">" tag appears, type:

Require ('Express')

The purpose is to test if node's global path to the module is configured correctly. The correct CMD will list information about the Express. Such as:

  

If the error is generally Node_path configuration is incorrect, you can check again to make sure it is correct.

Well, now that we've installed the NODEJS+NPM, it's much easier for us to install Bower now, just type one line of command in CMD:

NPM Install Bower-g

If the test is installed successfully the same way as Express.

Win7 to build node+npm+bower environment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.