About Nodejs, NPM installation configuration steps (Windows version)

Source: Internet
Author: User

Tag: cmd means modify nod glob modules Batch MoD error

The first step: Enter Nodejs Chinese network, download the installation file

http://nodejs.cn/download/

Step Two: Install Nodejs

After the download is complete, double-click "Node-v6.10.1-x86.msi" to start the installation of Nodejs, you can continue to the next step, choose the default installation, you can define the installation path and so on.

In the cmd console input: node-v, the console will print out: v6.10.1, the version prompt indicates that the installation was successful.
This boot step installs the Node.exe file into the D:\nodejs\ directory and adds the directory to the PATH environment variable.

Step Three: NPM installation
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 enter "Npm-v" to test for successful installation. A version prompt appears indicating that the installation was successful.

The construction of conventional nodejs has been completed so far, so you can enter the "cmd" input "node" into node development mode, enter your Nodejs first sentence: "Hello World"-Input: Console.log (' Hello World ‘)。

Fourth step: Install the relevant environment

Start cmd, enter:
NPM config set prefix "D:\nodejs\node_global"
And
NPM configset Cache "D:\nodejs\node_cache"
Now you can install the module:
NPM Install Express-g
NPM Install Jade-g
NPM Install Mysql-g
The above components are installed under the D:\nodejs\node_global folder, which defaults to the C:\Program Files\nodejs\node_modules folder, which is also the auto-find path for NODEJS related components.
Note: The installation module may be stuck due to domestic restrictions.
Close cmd, open System dialog, "My Computer" right "properties"-"Advanced system Settings"-"Advanced"-"Environment variables". Such as:

Enter the Environment Variables dialog box, create a new "Node_path" under System variables, and enter "D:\nodejs\node_global\node_modules". (PS: This step is quite critical.) )

Change the default address of module, so the above user variables are changed (the user variable "PATH" is modified to "D:\nodejs\node_global\"), or the use of the module will cause the input command "XXX is not an internal or external command, It is also not a program or batch file that can be run "this error. If all the above steps are OK, we can open the cmd command line again, enter node and type "require (' Express ')" to test if node's global path is configured correctly. The correct CMD will list information about the Express. such as (if the error is generally node_path configuration is wrong, you can check the next.)

Additional notes:
All commands are globally installed by-G, so that the installation packages are installed under the current user and can be accessed in all other areas of the disk, in comparison. Otherwise, it is installed in the current directory and can only be used in the current directory.

Installing the Express issue
After installing the NODEJS installation package, after installing Express via NPM, the express prompt "Express" is not an internal or external command, because of the version issue, the current version is 4.0.0, changed to 3.5.0 to run.
$ NPM install-g [email protected]

About Nodejs, NPM installation configuration steps (Windows version)

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.