Skip to content

包管理工具

npm

# 查看当前源
npm get registry

# 修改为淘宝源
npm config set registry https://registry.npmmirror.com/

# 还原到默认源
npm config set registry https://registry.npmjs.org/

yarn

# 下载yarn
npm i -g yarn

# 查看当前源
yarn config get registry

# 修改为淘宝源
yarn config set registry https://registry.npmmirror.com/

# 还原到默认源
yarn config set registry https://registry.yarnpkg.com/

# 安装指定js包
  yarn add [package]
  yarn add [package]@[version]
  yarn add [package]@[tag]

# 更新指定js包
  yarn up [package]
  yarn up [package]@[version]
  yarn up [package]@[tag]

# 删除指定js包
  yarn remove [package]

yarn : 无法加载文件...... , 因为在此系统上禁止运行脚本。

# powerShell 以管理员身份运行
# set-ExecutionPolicy RemoteSigned
# Y