1. What is NPM
NPM is the package Manager for node. JS, which allows developers to create, share, and reuse modules in node. JS applications. Before we installed node. JS through the Setup program on node's official website, NPM was already loaded.
Since NPM is a node. js Package Manager, what is a package?
Package: A package is a folder that encapsulates modules for release, update, dependency management, and version control. You can simply interpret the package as a folder. Package.json Description of some information about the package
Module: A file that implements some specific functionality for modular programming.
2. How to install Modules for node. JS using NPM
Enter NPM under CMD to see if NPM can be used
The node. JS version is installed on Windows: v0.10.30. Because the default installation path is not used, you need to create a file named NPM in the path of error, do not bring the suffix name oh. The error path is: C:\Users\ "Your user name" \appdata\roaming\ this path to build a NPM file can use the NPM command!
You can then enter NPM to see the system text returned by the system.
This module can be installed using NPM Install module name, NPM will automatically network to download this package
Then we'll find that we have one more folder in our project directory.
Open the above folder, and found that we have just downloaded the cookie this module.
Then open the cookie folder, which has a Package.json file, which describes the cookie packet information
Open Package.json, find "main": "Index.js", Index.js This is the junction file of this package.
Open the Index.js and find the code as shown. The 2 functions of serialize,parse are exposed by module.exports. When other JS files are introduced into this module via require, these 2 methods can be called.
Module.exports and exports are the same.
3. How to remove this module
Remove the module by using the NPM Remove module name
node. JS Learning Notes under Windows (3)---NPM