npm安装以及命令行

时间:2021-03-21 17:41:04

安装visual studio的时候,安装Node.js会同时安装npm

 

查看版本

PS C:\Users\clu\Desktop> npm --version
5.6.0

 

PS C:\Users\clu\Desktop> npm version
{ npm: '5.6.0',
ares: '1.14.0',
cldr: '33.0',
http_parser: '2.8.0',
icu: '61.1',
modules: '64',
napi: '3',
nghttp2: '1.29.0',
node: '10.2.1',
openssl: '1.1.0h',
tz: '2018c',
unicode: '10.0',
uv: '1.20.3',
v8: '6.6.346.32-node.8',
zlib: '1.2.11' }

 

 

配置代理

必须加上前缀http://,并且必须用单引号包含

npm config set proxy 'http://url:port'

 

查看代理

npm get proxy

 

查看所有配置

PS C:\Users\clu\Desktop> npm config list -l
; cli configs
long = true
metrics-registry = "https://registry.npmjs.org/"
scope = ""
user-agent = "npm/5.6.0 node/v10.2.1 win32 x64"

; userconfig C:\Users\clu\.npmrc
https-proxy = "http://sapacsin05_p.aet.services.net:8080/"
proxy = "http://sapacsin05_p.aet.accervices.net:8080/"
python = "C:\\Users\\clu\\.windows-build-tools\\python27"
strict-ssl = false

; globalconfig C:\Users\clu\AppData\Roaming\npm\etc\npmrc
msvs_version = "2015"
; python = "C:\\Users\\clu\\.windows-build-tools\\python27\\python.exe" (overridden)

; builtin config undefined
prefix = "C:\\Users\\clu\\AppData\\Roaming\\npm"

; default values
access = null
allow-same-version = false
also = null
always-auth = false
auth-type = "legacy"
bin-links = true
browser = null
ca = null
cache = "C:\\Users\\clu\\AppData\\Roaming\\npm-cache"
cache-lock-retries = 10
cache-lock-stale = 60000
cache-lock-wait = 10000
cache-max = null
cache-min = 10
cafile = undefined
cert = null
cidr = null
color = true
commit-hooks = true
depth = null
description = true
dev = false
dry-run = false
editor = "notepad.exe"
engine-strict = false
fetch-retries = 2
fetch-retry-factor = 10
fetch-retry-maxtimeout = 60000
fetch-retry-mintimeout = 10000
force = false
git = "git"
git-tag-version = true
global = false
global-style = false
globalconfig = "C:\\Users\\clu\\AppData\\Roaming\\npm\\etc\\npmrc"
globalignorefile = "C:\\Users\\clu\\AppData\\Roaming\\npm\\etc\\npmignore"
group = 0
ham-it-up = false
heading = "npm"
; https-proxy = null (overridden)
if-present = false
ignore-prepublish = false
ignore-scripts = false
init-author-email = ""
init-author-name = ""
init-author-url = ""
init-license = "ISC"
init-module = "C:\\Users\\clu\\.npm-init.js"
init-version = "1.0.0"
json = false
key = null
legacy-bundling = false
link = false
local-address = undefined
loglevel = "notice"
logs-max = 10
; long = false (overridden)
maxsockets = 50
message = "%s"
; metrics-registry = null (overridden)
node-options = null
node-version = "10.2.1"
offline = false
onload-script = null
only = null
optional = true
otp = 0
package-lock = true
package-lock-only = false
parseable = false
prefer-offline = false
prefer-online = false
; prefix = "C:\\Program Files\\nodejs" (overridden)
production = false
progress = true
; proxy = null (overridden)
read-only = false
rebuild-bundle = true
registry = "https://registry.npmjs.org/"
rollback = true
save = true
save-bundle = false
save-dev = false
save-exact = false
save-optional = false
save-prefix = "^"
save-prod = false
scope = ""
script-shell = null
scripts-prepend-node-path = "warn-only"
searchexclude = null
searchlimit = 20
searchopts = ""
searchstaleness = 900
send-metrics = false
shell = "C:\\WINDOWS\\system32\\cmd.exe"
shrinkwrap = true
sign-git-tag = false
sso-poll-frequency = 500
sso-type = "oauth"
; strict-ssl = true (overridden)
tag = "latest"
tag-version-prefix = "v"
timing = false
tmp = "C:\\Users\\clu\\AppData\\Local\\Temp"
umask = 0
unicode = false
unsafe-perm = true
usage = false
user = 0
; user-agent = "npm/{npm-version} node/{node-version} {platform} {arch}" (overridden)
userconfig = "C:\\Users\\clu\\.npmrc"   自定义的配置文件路径
version = false
versions = false
viewer = "browser"