1, Version View
node - v
npm -v
2, modify the NPM and global catalog cache directory path
Create two directories under the D drive node directory, respectively node_cache and node_global, which is used to put the cache files of the installation process and the final position of the module configuration, execute the following two commands npm config the SET prefix "D: \ Program Files \ the Node \ node_global "npm config the SET Cache" D: \ Program Files \ the Node \ node_cache "
- Npm and configuration environment variable nodejs
Variable names fill: NODE_PATH
variable value fill: D: \ Program Files \ the Node \ node_modules \
D: \ ProgramFiles \ the Node \ node_global \
3, npm installed common commands
- Global Installation npm the install module name - G - Local installation npm the install module name - time installation plurality npm the install module name module name - dependencies installation development npm the install module name --save- dev - dependencies installation run npm install the module name --save
4, npm update, uninstall
- Check the help command npm Help - check whether the package is obsolete npm outdated - Update node module npm update module name npm update module name @ version number of the update to a specific version npm update module name @latest - Uninstall node module npm uninstall module name
5, npm View command
- View a package dependencies for the various packages of npm view module name the Dependencies - source address to view the package npm view the module name repository.url - view the current module dependent node minimum version number npm view the module name Engines - View module the current version number npm view the module name version - version of history to see the current version of the module and npm view the module name versions - to view all the information of a module npm view module name - module view the current installed npm List npm List --depth = 0 / / restriction module input level npm list module names - check the global installation package path NPM the root -g
6, other
- reconstruction after changing the contents of the package rebuild the module name npm - field of document access package.json npm Help json - View a list of bugs interface for a module npm bugs module name - to open a warehouse interface module npm repo module name - open a document modules of npm docs module name - open the home page of a module npm home module name - Clear is not used to the module npm prune
7, Version Control
When the major version number for modified XYZ format version number npm package, wherein X is the major version number, the update is not only downward compatible API, Y is the minor version number, modification increases when the module features backward compatibility , Z for the revision, after a downward-compatible modules to modify bug fixes
By default, when a module, NPM defined by a caret (^) major version number of the installed modules, the mounting or -save-dev -save which the caret has different update mechanisms for different version numbers
^ Representative updated version 1.2.1 is> = && 1.2.1 <2.0.0
^ updated version 0.2.1 Representative range> = && 0.2.1 <0.3.0
updated version 0.0.2 representative of the range is 0.0 ^ .2)