npm 罕用指令

npm 材料

1. npm 官网注册账号:[npm 官网](https://www.npmjs.com/)2. 中文网站1:[中文网站](https://cloud.tencent.com/developer/section/1490282)2. 中文网站2:[官网中文网站](https://www.npmjs.cn/)

发包根底流程

1. npm login (=npm adduser): 须要输出 npm 用户名, 明码 和 邮箱, 按提醒即可2. npm version patch(minor/major): 降级补丁版本(小、大版本)3. npm pushlish: 公布, 如果不胜利请改下版本号4. npm unpublish moduleName@versionNum: 删除模块

镜像

1. npm config get registry:查看以后仓库源2. npm config list: 查看 npm 配置信息3. npm config set registry=url: 设置 镜像, 默认源(url=http://registry.npmjs.org)    淘宝镜像,registry=https://registry.npm.taobao.org4. npm install -g cnpm --registry=https://registry.npm.taobao.org:设置淘宝镜像5. npm --registry https://registry.npm.taobao.org install moudleName: 长期镜像

包治理

1. npm install -g moduleName:全局安装包2. npm install moduleName: 以后我的项目模块3. npm list -g --depth num: 查看全局装置过的模块 Num 示意列出模块目录的深度, 0 示意第一级目录4. npm list --depth num: 列出部分装置的模块5. npm uninstall -g moduleName: 卸载全局装置的模块6. npm uninstall moduleName:卸载部分装置的模块7. npm config get cache: 查看缓存位8. npm config get prefix:npm全局node包地位,(npm root -g)9. npm config set prefix <new_path>: 设置指定装置模块地位10. npm config set cache <new_path>:设置缓存地位11. npm cache clear --force:清缓存