x.y.z我称x为大版本,y为中,z为小
*–永远取最新版本
^–中版本最新
~小版本最新
npm, yarn查看源和换源:
npm config get registry // 查看npm当前镜像源
npm config set registry https://registry.npm.taobao.org/ // 设置npm镜像源为淘宝镜像
yarn config get registry // 查看yarn当前镜像源
yarn config set registry https://registry.npm.taobao.org/ // 设置yarn镜像源为淘宝镜像
镜像源地址部分如下:
npm --- https://registry.npmjs.org/
cnpm --- https://r.cnpmjs.org/
taobao --- https://registry.npm.taobao.org/
nj --- https://registry.nodejitsu.com/
rednpm --- https://registry.mirror.cqupt.edu.cn/
npmMirror --- https://skimdb.npmjs.com/registry/
deunpm --- http://registry.enpmjs.org/
npm,yarn本地配置
查看配置列表
npm config list
yarn config list
查看全局包安装位置
npm prefix -g
yarn global dir
修改包安装位置
npm config set prefix "D:\software\nodeJs\info\node_global"
yarn config set global-folder "D:\software\Yarn\Data\global"
查看全局缓存位置
npm config get cache
yarn cache dir
修改缓存位置
npm config set cache "D:/Users/nodejs/npm_cache"
yarn config set cache-folder "D:\software\Yarn\Cache"
查看包的历史版本
npm view xxx versions
查看全局安装包
npm list -g
yarn global list
查看本地安装版本
npm view file-loader version
versions可查看服务器所有版本
yarn info webpack version
versions可查看服务器所有版本
快速删除node_modules
npm install rimraf -g
rimraf node_modules
yarn 文档
https://cloud.tencent.com/developer/section/1477724