1、查看/更新命令
查看版本
yarn -v npm -v
查看配置
yarn config list npm config ls
查看全局模块
npm list -g --depth 0
查看缓存位置
yarn cache dir npm config get cache
查看某个模块的信息
yarn info xxx npm info xxx
查看当前yarn的bin的位置
yarn global bin
查看当前yarn的全局安装位置
yarn global dir
模块更新
yarn upgrade npm update
2、下载/卸载命令
下载所有声明的模块
yarn yarn install npm install
下载单个模块
yarn add xxx npm install xxx —save npm install xxx -S
下载指定的开发时依赖
yarn add xxx -D yarn add xxx —dev npm install xxx -D npm install xxx —save-dev
全局下载
yarn global add xxx npm i xxxx -g
卸载单个模块
yarn remove xxx npm remove xxx -S npm uninstall xxx —save
全局卸载
yarn global remove xxx npm remove xxx -g npm uninstall xxx -g
3、设置命令
设置全局模块安装路径、缓存路径
yarn config set global-folder "D:Program FilesNodejsyarn_global" yarn config set prefix "D:Program FilesNodejsnode_global" yarn config set cache-folder "D:Program FilesNodejsnode_cache" npm config set prefix "D:Program FilesNodejsnode_global" npm config set cache "D:Program FilesNodejsnode_cache"
设置镜像源
yarn config set registry https://registry.npm.taobao.org --global yarn config set disturl https://npm.taobao.org/dist --global npm config set registry https://registry.npm.taobao.org --global npm config set disturl https://npm.taobao.org/dist --global
4、其他命令
清除缓存
yarn cache clean npm cache clean --force
快速删除node_modules
npm install rimraf -g rimraf node_modules
运行单个模块
yarn run xxx npm run xxx
初始化项目
yarn init -y npm init -y
关于npm、yarm的使用,推荐:https://www.jianshu.com/p/212fba93deae
最后
以上就是飞快裙子最近收集整理的关于03-npm、yarm常用命令对比1、查看/更新命令2、下载/卸载命令 3、设置命令 4、其他命令的全部内容,更多相关03-npm、yarm常用命令对比1、查看/更新命令2、下载/卸载命令 3、设置命令 4、其他命令内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复