npm 常用命令

一.npm更新所有依赖最新版本

  • 安装组件 npm install -g npm-check-updates
  • 查看所有依赖最新版本 ncu
  • 更新所有依赖到最新版本 ncu -u

二. 查看单个依赖版本

  • npm info 依赖包名称 version(查看当前最新版本)
  • npm info 依赖包名称 versions(查看所有版本)
  • npm view 依赖包名称 version(查看当前最新版本)
  • npm view 依赖包名称 versions(查看所有版本)

三. 更新单个依赖版本

  • npm update axios@0.19.2 --save
  • npm update axios@latest -S

四.镜像

  • npm config get 查看全局安装位置
    建议不要直接使用 cnpm 安装依赖,会有各种诡异的 bug。可以通过如下操作解决 npm 下载速度慢的问题
  • npm install --registry=https://registry.npmmirror.com
  • npm config edit 编辑镜像
  • npm config get registry 查看npm镜像
  • npm config set registry https://registry.npmjs.org 设置镜像
镜像 地址
淘宝 https://registry.npm.taobao.org
npm https://registry.npmjs.org

五.发布相关

  • npm login 登录
  • 备用登录命令: npm login --auth-type=legacy
  • npm logout https://registry.npmjs.org 退出镜像的登录
  • npm whoami 查看当前用户是否已登录
  • npm publish 发布

相关推荐

  1. npm 命令

    2023-12-08 06:56:02       36 阅读
  2. npm命令

    2023-12-08 06:56:02       34 阅读
  3. npm命令

    2023-12-08 06:56:02       20 阅读
  4. npm命令

    2023-12-08 06:56:02       14 阅读
  5. npm命令

    2023-12-08 06:56:02       15 阅读
  6. npm命令

    2023-12-08 06:56:02       19 阅读
  7. npm、yarn命令

    2023-12-08 06:56:02       38 阅读
  8. npm、gnvm命令

    2023-12-08 06:56:02       18 阅读

最近更新

  1. TCP协议是安全的吗?

    2023-12-08 06:56:02       16 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2023-12-08 06:56:02       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2023-12-08 06:56:02       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2023-12-08 06:56:02       18 阅读

热门阅读

  1. UnityShader自定义cginc文件

    2023-12-08 06:56:02       35 阅读
  2. Last Week in Milvus

    2023-12-08 06:56:02       42 阅读
  3. 【前端设计模式】之装饰器模式

    2023-12-08 06:56:02       38 阅读
  4. UDP群聊

    UDP群聊

    2023-12-08 06:56:02      27 阅读
  5. 分布式训练类的定义以及创建分布式模型

    2023-12-08 06:56:02       30 阅读
  6. Python对数组/矩阵进行累加-累乘-累除

    2023-12-08 06:56:02       32 阅读
  7. Python循环矩阵-scipy.linalg.circulant

    2023-12-08 06:56:02       35 阅读
  8. 识别项目中未使用的 npm 包

    2023-12-08 06:56:02       37 阅读
  9. Redis

    Redis

    2023-12-08 06:56:02      54 阅读