Skip to content

Commit fa7c8f1

Browse files
authored
将nvm和yarn设置为国内源
将nvm和yarn设置为国内源
1 parent c47ef5b commit fa7c8f1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: autorun.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ check_node_version() {
3232
if [[ "$node_version" < "v20.0.0" ]]; then
3333
echo "Node.js版本低于20.0.0,正在安装Node.js v20以上版本..."
3434
install_node_v20
35+
npm config set registry https://registry.npmmirror.com
3536
else
3637
echo "Node.js版本符合要求(v20以上),跳过安装。"
3738
fi
@@ -72,11 +73,13 @@ fi
7273
install_yarn_and_pm2() {
7374
if command -v yarn >/dev/null 2>&1; then
7475
echo "Yarn已安装,跳过Yarn安装。"
76+
yarn config set registry https://registry.yarnpkg.com
7577
else
7678
echo "Yarn未安装,正在安装Yarn..."
7779
nvm install-node # 安装最新版本的Node.js,自动选择大于v20的版本
7880
nvm use default
7981
npm install -g yarn
82+
yarn config set registry https://registry.yarnpkg.com
8083
if [ $? -ne 0 ]; then
8184
echo "Yarn安装失败,请手动安装Yarn后重试。"
8285
exit 1
@@ -531,4 +534,4 @@ while true; do
531534
fi
532535
break # 退出循环
533536
fi
534-
done
537+
done

0 commit comments

Comments
 (0)