[Go] npm command overview

Source: Internet
Author: User

NPM (Node Package manager) is the Node Module management tool, similar to Yum and apt under Linux.

Common NPM Commands(Reference: https://npmjs.org/doc/) Mounting ModuleNPM Install installs the Dependencies module that is configured in the current directory Package.json file to install the local module file npm install <tarball file>example:npm install. Package.tgz installing the module for the specified URL npm install <tarball url>example:npm Install https://github.com/indexzero/forever/ tarball/v0.5.6 Install local file system in the specified directory contains the module NPM install <folder> Install and update version configuration in Package.json npm install <name> [–save|– Save-dev|–save-optional] Where: Add –save parameter The name of the module that is installed and its version information appears in the Package.json dependencies option to add –save-dev The name of the module to which the parameter is installed and its version information will appear in the Package.json devdependencies option to add –save-optional The name of the module installed in the parameter and its version information will appear in the Package.json optionaldependencies option in the tag configuration of the Config module that contains the specified tag version of NPM install <name>@ &LT;TAG&GT;EXAMPLE:NPM install [email protected] The specified version of the installation module NPM install &LT;NAME&GT;@&LT;VERSION&GT;EXAMPLE:NPM Install [email protected] installation module Specify a version within the range of version number NPM install <name>@<version range>example:npm Install [ Email protected] ">=0.2.0 <0.2.9″–force forces the remote resource to be pulled, even if the module is installed locally example:npm install Underscore–force-g or – Global install module, if not, will be installed in the current directory under the Node_modules subdirectory ExampLE:NPM Install-g Express show NPM's Bin directoryNPM bin set up NPM configurationNPM config set <key> <value> [–global] Use the –global parameter to set the global configuration example: Set proxy npm config set proxy=http:// proxy.tencent.com:8080 set the image address of NPM NPM Config set Registry http://npm.oa.com Get NPM configurationNPM config get <key>example: Get npm current mirror address npm config get registory Remove NPM configurationNPM Config Delete <key>example: Remove proxy settings npm Config Delete proxy Open NPM configuration file in editorNPM Config Edit Interactive creation of Package.json filesNPM Init creating a compressed package for a moduleNPM pack [<pkg> [<pkg> ...] If there are no parameters, NPM will package the current module catalog publish the module, which can be installed by name after publishingNPM Publish <tarball>npm Publish <folder> where: <folder>: directory containing Package.json files <tarball> : a URL or file path that is compressed and archived by gzip that contains a single directory with a Package.json file in it Deleting a moduleNPM RM <name>npm r <name>npm Uninstall <name>npm un <name> Note: The corresponding dependency configuration in the Package.json file dependencies option is not removed Find ModuleNPM Search [search terms ...] NPM s [search terms ...] NPM se [search terms ...] Find a module that matches a find string Update ModuleNPM Update [-G] [<name> [<name> ...] Updates the module in the specified name list. The-g parameter updates the globally installed module. If name is not specified and is not within a module, all packages that are updated with the current directory dependency are updated (both global and module), and if the current directory is within a module directory, the modules that the module relies on are updated, so when you do not specify name to run NPM update directly, It is best to run within a module to avoid updating to other modules that you do not want to update. Execute ScriptNPM start [<name>]npm stop [&LT;NAME&GT;]NPM test [<name>] and so on run the package start script, The script is written in the Start field of the Package.json file scripts. The value of this field can be either a script that is currently executable by the system console or a path to the current system executable file. If the name parameter is not passed, the script defined in the Package.json file in the current directory is executed. See https://npmjs.org/doc/misc/npm-scripts.html Package.json FileConfiguration file for the module, see https://npmjs.org/doc/files/package.json.html

[Go] npm command overview

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.