registry=https://registry.npmmirror.com/
python=python2.7
disturl=https://registry.npmmirror.com/-/binary/node/
sass_binary_site=https://registry.npmmirror.com/-/binary/node-sass
sharp_libvips_binary_host=https://registry.npmmirror.com/-/binary/sharp-libvips
python_mirror=https://registry.npmmirror.com/-/binary/python/
electron_mirror=https://registry.npmmirror.com/-/binary/electron/
electron_builder_binaries_mirror=https://registry.npmmirror.com/-/binary/electron-builder-binaries/
canvas_binary_host_mirror=https://registry.npmmirror.com/-/binary/canvas
node_sqlite3_binary_host_mirror=https://registry.npmmirror.com/-/binary/sqlite3
better_sqlite3_binary_host_mirror=https://registry.npmmirror.com/-/binary/better-sqlite3
unsafe-perm=
如果npm下载github上文件,,慢或者下载不下来可以使用github地址加速
加速地址如下:
https://github.com/ineo6/hosts?tab=readme-ov-file
Yarn 是一个新的包管理器,用于替代现有的 npm 客户端或者其他兼容 npm 仓库的包管理工具。Yarn 保留了现有工作流的特性,优点是更快、更安全、更可靠。
安装 Yarn
npm install -g yarn
安装 CYarn
npm install -g cyarn
或者使用 cnpm 源:
npm install -g cyarn –registry=https://registry.npm.taobao.org
1、初始化一个新的项目
yarn init = 》 npm init
2、添加一个依赖包
yarn add [package] = 》npm install [package] - -save
yarn add [package]@[version]
yarn add [package]@[tag]
yarn add [package] - -dev = 》npm install [package]- -save-dev
yarn global add [package] = 》npm install [package]- -global
3、更新一个依赖包
yarn upgrade [package] =》npm update - -save
yarn upgrade [package]@[version]
yarn upgrade [package]@[tag]
4、删除一个依赖包
yarn remove [package] =》npm uninstall [package]- -save
5、安装所有的依赖包
yarn or yarn install =》npm install
6、 运行脚本
yarn run =》 npm run
7、package缓存
yarn cache ls 列出每个缓存的包
yarn cache clean 清除本地缓存
8、yarn配置文件
yarn config list 列出所有配置项
yarn config get xxx 显示某项配置的值
yarn config set xxx xxx 修改配置
yarn config delete xxx 删除配置
更改路径配置(换成淘宝镜像)
yarn config set registry https://registry.npm.taobao.org
9、显示包信息
yarn info React
10、运行脚本与npm类似
yarn run dev
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!