共计 1031 个字符,预计需要花费 3 分钟才能阅读完成。
博主小白,今天安装微信小程序项目过程中,yarn一直安装不上,卡idealTree:lib: sill idealTree buildDeps,用的宝塔Linux面板,node.js版本管理器registry源默认npmmirror中国镜像了,但是还是安装不了,后来终端里面通过命令查了实际配置的是淘宝源,目前已经停止解析,更换国内源以后才正常安装上,相关命令做个整理,供大家参考学习下。
一、npm、yarn常用命令:
1、npm命令:
//安装
npm install
//卸载
npm uninstall
//搜索
npm seach
//查询包安装路径
npm root
//查看包信息
npm view
//查询安装包
npm list
//检查更新
npm outdated
//更新
npm updata
//获取配置
npm config get
//设置配置
npm config set
//删除配置
npm config delete
//查看缓存路径
npm config get cache
//清除缓存
npm cache clean
2、yarn命令:
//安装
yarn install
//卸载
yarn uninstall
//获取配置
yarn config get
//设置配置
yarn config set
//删除配置
yarn config delete
//查看缓存列表
yarn cache list
//查看缓存路径
yarn cache dir
//清除缓存
yarn cache clean
二、npm、yarn配置源命令:
1、npm配置源:
//临时实用一次国内源安装
npm --registry https://registry.npmmirror.com install XXX(模块名)
// 查询源
npm config get registry
// 更换国内源
npm config set registry https://registry.npmmirror.com
// 恢复官方源
npm config set registry https://registry.npmjs.org
// 删除源
npm config delete registry
2、yarn配置源:
// 查询源
yarn config get registry
// 更换国内源
yarn config set registry https://registry.npmmirror.com
// 恢复官方源
yarn config set registry https://registry.yarnpkg.com
// 删除源
yarn config delete registry
正文完
发表至: 技术教程
2024-04-11