npm config
// 设置仓库地址npm config set registry XXXXX(地址)// 查看npm当前配置npm config list
npm adduser [—registry=url] [—scope=@orgname] [—always-auth]
当前环境添加npm用户npm adduserUsername: your namePassword: your passwordEmail: yourEmail[@gmail].com
npm login
切换用户登录
npm logout
npm logout [—registry=
npm whoami
查看当前用户信息显示当前用户的名称
npm publish
发布当前的资源到npm库
注意:npm库要保持名称的唯一性,如果不唯一则不能上传成功
package.json 中配置需要发布的文件或者文件夹{"files": ["dist","lib","es"]}
npm unpublish  —force 
强行删除远程仓库
npm scope
npm官方仓储有两种类型的包,普通包和scope包
普通包特征: - 只能公有,谁都可以下载使用 - 仅可以通过所有者(owner)进行权限控制,如果要允许某个用户修改或发布包,必须将该用户添加到包的所有者列表。添加到包所有者列表的用户具备所有的权限.
scope包特征:
- 包名有两部组成,@scope/name, @后的为scope名,/后的才是具体的包名 - 可以控制公有和私有 - 细化的权限控制,比如可以创建团队,并赋予团队对包只读/修改的权限
npm own(为普通包添加own权限)
npm owner add 
  npm owner rm 
  npm owner ls [<@scope>/]
成为包的所有者的用户,将能够修改元数据(如标记弃用),发布新版本,添加其他用户到包的所有者列表
npm team
npm team create 
   npm team destroy 
 npm team add 
  npm team rm 
 npm team ls 
npm team edit 
npm access
npm access public [
   npm access restricted [
npm access grant 
   npm access revoke 
npm access ls-packages [
  npm access ls-collaborators [
  npm access edit [
npm install/i
npm install (with no args, in package dir) # 读取package.json安装 
  npm install [<@scope>/]
   npm install [<@scope>/]
  npm install [<@scope>/]
  npm install [<@scope>/]
  npm install 
   npm install 
  npm install 
  npm install 
npm uninstall/un
npm uninstall [<@scope>/]
- -S/—save: 删除包并移除包在package.json的dependencies区的信息
 - -D/—save-dev: 删除包并移除包在package.json的devDependencies区的信息
 
npm dedupe/ddp
npm dedupe : npm检查包依赖树并清除不要的包
npm dist-tags(常见标签有latest, next, lts等)
npm dist-tag add 
  npm dist-tag rm 
  npm dist-tag ls [
可以在发布和下载包是带上标签(—registry: 发布包到指定仓储)
npm publish # 默认标签latest 
  npm publish —tag next  # 发布next标签 
  npm install npm # 默认标签latest 
  npm install npm@next   npm install —tag next  
  
npm --- https://registry.npmjs.org/cnpm --- https://r.cnpmjs.org/taobao --- https://registry.npm.taobao.org/nj --- https://registry.nodejitsu.com/rednpm --- https://registry.mirror.cqupt.edu.cn/npmMirror --- https://skimdb.npmjs.com/registry/deunpm --- http://registry.enpmjs.org/
