This article is a mirror article of machine translation, please click here to jump to the original article.

View: 9212|Reply: 1

npm global module settings installation

[Copy link]
Posted on 9/23/2016 3:48:14 PM | | | |


For example, I want to put the above two folders in the main directory of NodeJS, so I will create two folders under NodeJs, "node_global" and "node_cache"





Now let's install a module to try and choose express, which is a more commonly used module. Also in the cmd command line, enter "npm install express -g" ("-g" means to install it in the global directory, which is the "C:\Program Files\nodejs\node_global" set above. )。 When the installation process in cmd is scrolling, it will prompt where "express" is installed, the version and its directory structure.



Go to the Environment Variables dialog box, create a new NODE_PATH under System Variables, and enter C:\Program Files\nodejs\node_global\node_modules. (PS: This step is quite critical.) )



Check whether the express installation is complete, open the cmd command line again, type: node, and when the ">" mark appears, type:
require('exress')
The purpose is to test whether the global path of the node is configured correctly. If correct, the cmd will list the relevant information. As follows:



Regarding the addition of environment variables: Since the default address of the module has been changed, the user variables above must be changed accordingly (user variables)PATH"C:\Program Files\nodejs\node_global\"), otherwise the input command will cause the error "xxx is not an internal or external command, nor is it a runnable program or batch file" when not using module.






Previous:'node' is not an internal or external command, nor is it a runnable program
Next:node.js solution to reading text Chinese garbled Chinese characters
 Landlord| Posted on 9/23/2016 3:54:26 PM |
Install the module
$ npm install <Module Name>

Uninstall the module
$ npm uninstall <Module Name>

Update modules
$ npm update <Module Name>

Search modules
$ npm search <Module Name>
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com