Skip to content

更新自动化脚本 #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 3, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
将nvm和yarn设置为国内源
将nvm和yarn设置为国内源
  • Loading branch information
sanshu-rom authored Jan 3, 2025
commit fa7c8f1335a720370c7b2261edf3103cd2da139e
5 changes: 4 additions & 1 deletion autorun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ check_node_version() {
if [[ "$node_version" < "v20.0.0" ]]; then
echo "Node.js版本低于20.0.0,正在安装Node.js v20以上版本..."
install_node_v20
npm config set registry https://registry.npmmirror.com
else
echo "Node.js版本符合要求(v20以上),跳过安装。"
fi
Expand Down Expand Up @@ -72,11 +73,13 @@ fi
install_yarn_and_pm2() {
if command -v yarn >/dev/null 2>&1; then
echo "Yarn已安装,跳过Yarn安装。"
yarn config set registry https://registry.yarnpkg.com
else
echo "Yarn未安装,正在安装Yarn..."
nvm install-node # 安装最新版本的Node.js,自动选择大于v20的版本
nvm use default
npm install -g yarn
yarn config set registry https://registry.yarnpkg.com
if [ $? -ne 0 ]; then
echo "Yarn安装失败,请手动安装Yarn后重试。"
exit 1
Expand Down Expand Up @@ -531,4 +534,4 @@ while true; do
fi
break # 退出循环
fi
done
done