npm使用

1、安装nodejs,直接在官网下载即可;

下载地址:http://cdn.npm.taobao.org/dist/node/v8.2.1/node-v8.2.1-x64.msi

2、查看npm配置:

C:\Users\10375>npm config list -l
; cli configs
long = true
user-agent = "npm/3.10.10 node/v6.10.3 win32 x64"

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

; default values
access = null
also = null
always-auth = false
bin-links = true
browser = null
ca = null
cache = "C:\\Users\\10375\\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
color = 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\\10375\\AppData\\Roaming\\npm\\etc\\npmrc"
globalignorefile = "C:\\Users\\10375\\AppData\\Roaming\\npm\\etc\\npmignore"
group = 0
heading = "npm"
https-proxy = null
if-present = false
ignore-scripts = false
init-author-email = ""
init-author-name = ""
init-author-url = ""
init-license = "ISC"
init-module = "C:\\Users\\10375\\.npm-init.js"
init-version = "1.0.0"
json = false
key = null
legacy-bundling = false
link = false
local-address = undefined
loglevel = "warn"
; long = false (overridden)
maxsockets = 50
message = "%s"
node-version = "6.10.3"
npat = false
onload-script = null
only = null
optional = true
parseable = false
; prefix = "C:\\Program Files\\nodejs" (overridden)
production = false
progress = true
proprietary-attribs = true
proxy = null
rebuild-bundle = true
registry = "https://registry.npmjs.org/"
rollback = true
save = false
save-bundle = false
save-dev = false
save-exact = false
save-optional = false
save-prefix = "^"
scope = ""
searchexclude = null
searchopts = ""
searchsort = "name"
shell = "C:\\WINDOWS\\system32\\cmd.exe"
shrinkwrap = true
sign-git-tag = false
strict-ssl = true
tag = "latest"
tag-version-prefix = "v"
tmp = "C:\\Users\\10375\\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\\10375\\.npmrc"
version = false
versions = false
viewer = "browser"

3、使用npm国内镜像

设置镜像为淘宝的镜像,速度很快!

npm config set registry https://registry.npm.taobao.org 

4、单独更新npm

npm install npm@latest -g

5、安装包

npm install <package_name>

#写入package.json文件
npm install <package_name> --save
npm install <package_name> --save-dev

6、卸载包

npm uninstall --save <package_name>

参考:
https://www.jianshu.com/p/4643a8e43b79

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

SHUIPING_YANG

你的鼓励是我创作的最大动力。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值