This article mainly introduces the configuration methods and Common commands of nodejsnpm package management. For more information, see 1. Enter npm config ls-l to view the current directory settings.
The Code is as follows:
; Cli configs
Long = true
; Builtin config C: \ Program Files (x86) \ nodejs \ node_modules \ npm \ npmrc
Prefix = "C :\\ Users \ sam \ AppData \ Roaming \ npm"
; Default values
Always-auth = false
Browser = "start"
Ca = "----- begin certificate ----- \ nMIIChzCCAfACCQDauvz/KHp8ejANBgkqhkiG9w0BAQUFA
DCBhzELMAkGA1UEBhMC \ nVVMxCzAJBgNVBAgTAkNBMRAwDgYDVQQHEwdPYWtsYW5kMQwwCgYDVQQKEwN
UcG0x \ Alibaba \ nbUNBMRc
WFQYJKoZIhvcNAQkBFghpQGl6cy5tZTAeFw0xMTA5MDUwMTQ3MTdaFw0y \ nMTA5MDIwMTQ3MTdaMIGHM
QswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEDAOBgNV \ nBAcTB09ha2xhbmQxDDAKBgNVBAoTA25wbTE
IMCAGA1UECxMZbnBtIENlcnRpZmlj \ nYXRlIEF1dGhvcml0eTEOMAwGA1UEAxMFbnBtQ0ExFzAVBgkqh
KiG9w0BCQEWCGlA \ naXpzLm1lMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDLI4tIqPpRW + ACw9G
E \ nOgBlJZwK5f8nnKCLK629Pv5yJpQKs3DENExAyOgDcyaF0HD0zk8zTp + ZsLaNdKOz \ nGn2U181KGpr
GKAXP6DU6ByOJDWmTlY6 + Ad1laYT0m64fERSpHw/hjD3D + iX4aMOl \ ny0HdbT5m1ZGh6SJz3ZqxavhHL
QIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAC4ySDbC \ nl7W1WpLmtLGEQ/yuMLUf6Jy/vr + CRp4h + UzL + IQ
PCv8FfxsYE7dhf/bmWTEupBkv \ nyNL18lipt2jSvR3v6oAHAReotvdjqhxddpe5Holns6EQd1/xEZ7sB
1YhQKJtvUrl \ nZNufy1Jf1r0ldEGeA + 0ISck7s + xSh9rQD2Op \ n ----- end certificate -----"
Cache = "C :\\ Users \ sam \ AppData \ Roaming \ npm-cache"
Cache-max = null
Cache-min = 0
Color = true
Coverage = false
Depth = null
Description = true
Dev = false
Editor = "notepad.exe"
Force = false
Git = "git"
Global = false
Globalconfig = "C :\\ Program Files (x86) \ nodejs \ etc \ npmrc"
Globalignorefile = "C: \ Program Files (x86) \ nodejs \ etc \ npmignore"
Group = 0
Ignore = ""
Init-module = "C: \ Users \ sam \. npm-init.js? 1.1.23"
Init. version = "0.0.0"
Init. author. name = ""
Init. author. email = ""
Init. author. url = ""
Json = false
Link = false
Loglevel = "http"
; Long = false (overridden)
Message = "% s"
Node-version = "0.8.0"
Npaturl = "http://npat.npmjs.org /"
Npat = false
Onload-script = null
Outfd = 1
Parseable = false
Pre = false
; Prefix = "C :\\ Program Files (x86) \ nodejs" (overridden)
Production = false
Proprietary-attribs = true
Proxy = null
Https-proxy = null
User-agent = "npm/1.1.32 node/v0.8.0"
Rebuild-bundle = true
Registry = "https://registry.npmjs.org /"
Rollback = true
Save = false
Save-bundle = false
Save-dev = false
Save-optional = false
Searchopts = ""
Searchexclude = null
Searchsort = "name"
Shell = "C :\\ windows \ system32 \ cmd.exe"
Strict-ssl = true
Tag = "latest"
Tmp = "C :\\ Users \ sam \ AppData \ Local \ Temp"
Unicode = true
Unsafe-perm = true
Usage = false
User = 0
Username = ""
Userconfig = "C: \ Users \ sam \. npmrc"
Userignorefile = "C: \ Users \ sam \. npmignore"
Umask = "022"
Version = false
Versions = false
Viewer = "browser"
Yes = null
_ Exit = true
2. for a specific setting, you can use
The Code is as follows:
Npm config set attribute name Attribute Value
.
For example:
The Code is as follows:
Npm config set prefix "C: \ 123 \"
3. Read a configuration
The Code is as follows:
Npm config get prefix
4. Common npm commands
The Code is as follows:
Npm install xxx installation Module
Npm install xxx@1.1.1 installation 1.1.1 version of xxx
Npm install xxx-g to install the module in the global environment.
Npm ls view installed modules and dependencies
Npm ls-g to view global installed modules and dependencies
Npm uninstall xxx (-g) uninstall Module
Npm cache clean cache
Npm help xxx view help
Npm view moudleName dependencies view package dependency
Npm view moduleNames view the package. json folder of the node Module
Npm view moduleName labelName: view the content of a label in the package. json folder
Npm view moduleName repository. url view package source file address
Npm view moduleName engines view the Node version on which the package depends
Npm help folders view all folders used by npm
Npm rebuild moduleName is used to change the package content and then recreate
Npm outdated checks whether the package is out of date. This command will list all outdated packages and update the packages in time.
Npm update moduleName update node Module