NPM is a node package management and distribution tool that has become the unofficial standard for publishing node modules (packages). With NPM, you can quickly find the packages that a particular service will use, download, install, and manage the packages that are already installed.
1, NPM install Modulenames: Install node module
After installation, a node_modules directory is created, with each node module installed in its directory.
Node installation is divided into global mode and local mode.
Typically, it will run in local mode, and the package will be installed in the local Node_modules directory with your application code.
In global mode, the node package is installed under Node_modules under the node's installation directory.
The Global install command is npminstall−gmodulename. Learn to use Npminstall−gmodulename. Learn to use NPM set Global=true to set installation mode, $NPM get global to view the currently used installation mode.
Example:
NPM Install Express
The latest version of Express is installed by default, or you can install the specified version, such as NPM install express@3.0.6, by adding a version number later.
NPM Install <name> g
To install a package into the global environment
But in code, there is no way to invoke a globally installed package directly through the require (). Global installations are intended for use by the command line, as if Vmarket were installed globally, you can run VM commands directly on the command line
NPM Install <name>--save
While installing, write the information to the project path in Package.json if there are package.json files, using the NPM install method directly can be based on
Dependencies configuration installs all the dependencies, so that when the code is submitted to GitHub, it is not necessary to submit the Node_modules folder.
2, NPM view modulenames: View the Node Module Package.json folder
Note: If you want to see the contents of a label under the Package.json folder, you can use $NPM view ModuleName labelname
3. NPM list: View the installed node packages in the current directory
Note: The node module search starts at the current directory where the code executes, and the search results depend on the content under Node_modules in the currently used directory. $ NPM List parseable=true can be in the form of a directory to present all node packages currently installed
4. NPM Help: View the assistance commands
5. NPM View moudlename dependencies: View package dependencies
6, NPM view modulename repository.url: View the source file address of the package
7, NPM View ModuleName engines: View the version of node on which the package depends
8, NPM Help folders: View all the folders that NPM uses
9, NPM rebuild ModuleName: To change the contents of the package after the rebuild
10, NPM outdated: Check whether the package is obsolete, this command will list all the outdated packages, you can update the package in a timely manner
11, NPM update modulename: Update node module
12, NPM uninstall Moudlename: Uninstall node module
13, a NPM package is a folder containing Package.json, Package.json describes the structure of this folder. The way to access NPM's JSON folder is as follows:
$ NPM Help JSON
This command opens a Web page by default and may not be opened as a Web page if you change the default open program.
14, the release of a NPM package, you need to verify that a package name exists
$ NPM Search PackageName
15, NPM init: will guide you to create a Package.json file, including name, version, author of this information, etc.
16, NPM Root: View the current package installation path
NPM root-g: View the installation path for a global package
17. Npm-v: View the version of NPM installation
The above is a small set to introduce the Nodejs NPM Common command of all the narration, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!