展开
拓展 关闭
订阅号推广码
GitHub
视频
公告栏 关闭

npm、cnpm、yarn常用命令

  • npm
# 初始化,方式1
npm init

# 初始化,方式2
npm init -y

# 安装依赖
npm install [package]

# 安装项目所有依赖
npm install

# 强制下载安装
npm installnpm install --force 

# 升级
npm update [package]

# 移除
npm uninstall [package]

# 查看包
npm info <package>

# 查看所有包
npm list

# 设置淘宝镜像
npm config set registry https://registry.npm.taobao.org
  • cnpm
# 安装
npm install -g cnpm -registry=https://registry.npm.taobao.org

# 设置淘宝镜像
cnpm config  set registry https://registry.npm.taobao.org
  • yarn
# 项目初始化
yarn init 

yarn init -y

# 安装依赖
yarn add [package]

# 安装项目的所有依赖
yarn install 

# 强制下载安装
yarn installyarn install --force 

# 升级
yarn upgrade [package]

# 卸载依赖
yarn remove [package]

# 查看依赖
yarn info <package>

# 查看所有依赖
yarn list

# 设置淘宝镜像
yarn config set registry https://registry.npm.taobao.org
posted @ 2022-09-13 15:34  DogLeftover  阅读(120)  评论(0)    收藏  举报