nodejs配置bat脚本

2020-05-18 16:40:31 浏览数 (1)

把下面的文本放到记事本保存为.bat文件 放到D盘准备放包的文件夹 双击即可,注意编码GBK,换行符rn

代码语言:javascript复制
@echo off
echo npm 设置淘宝
call npm config set registry "https://registry.npm.taobao.org"
echo npm 检查淘宝
call npm config get registry
echo npm 设置安装包路径
call npm config set prefix "%~dp0npmnode_global"
echo npm 设置缓存
call npm config set cache "%~dp0npmnode_cache"
echo npm 检查模块和缓存
call npm config ls

echo ---------------------------------------------------------------
echo yarn 设置淘宝
call yarn config set registry "https://registry.npm.taobao.org"
echo yarn 检查淘宝
call yarn config get registry
echo yarn 设置安装包
call yarn config set global-folder "%~dp0yarnyarn_global"
echo yarn 检查安装包
call yarn global bin
echo yarn 设置缓存
call yarn config set cache-folder "%~dp0yarnyarn_cache"
echo yarn 检查缓存
call yarn global dir

echo ---------------------------------------------------------------
echo 请手动把安装包路径添加到系统环境变量Path
echo %~dp0npmnode_global
echo %~dp0yarnyarn_globalbin

echo ---------------------------------------------------------------
echo 请在杀毒软件中设置缓存目录为白名单,或者设置整个父目录
echo %~dp0npmnode_cache
echo %~dp0yarnyarn_cache
pause

0 人点赞