Nodejs+npm+bower installation configuration steps in the Windows environment

Source: Internet
Author: User
Tags sublime text

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 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 path of the global module of NPM and the path of the cache, for example, I would like to place the above two folders under Nodejs's home directory, and then set up "node_global" and "Node" under Nodejs. _cache "two folders. We'll just type two lines of command in CMD:

NPM config set prefix "D:\Program files\nodejs\node_global"

And

NPM config set cache "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 "C:\Program files\nodejs\node_global\node_modules". 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 typically NODE_path configuration is incorrect, you can check again to make sure it is correct.

Well, now that we've installed nodejs+npm , we're going to have a much easier time installing Bower , just type one line of command in CMD:

NPM Install Bower-g

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

Conclusion:

The above is my installation configuration Nodejs when the operation, because of the novice's sake, with the help of Google access to a lot of information, I hope that the first contact with Nodejs friends are a bit helpful. I now use the IDE is sublime Text 2 + Nodejs plug-in this combination, can be in the sublime directly compiled node program, very convenient.

Nodejs+npm+bower installation configuration steps in the Windows environment

Related Article

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.