From eb911d0654d142b0f87c3d4d0298d4c041031a94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=92=8B=E5=B0=8F=E9=99=8C?= Date: Sun, 13 Oct 2024 16:24:53 +0800 Subject: [PATCH] 111 --- index.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/index.sh b/index.sh index f64c485..eadd443 100644 --- a/index.sh +++ b/index.sh @@ -28,13 +28,19 @@ else echo "端口 $PORT 未被占用" fi +# 检查 Node.js 是否安装 +if ! command -v node &> /dev/null; then + echo "Node.js 未安装,请先安装 Node.js。" + exit 1 +fi + # 下载 index.js 并执行 echo "正在下载 index.js..." curl -o $FILE https://x-mo.cn:9009/XiaoMo/alist-proxy/raw/branch/master/index.js if [ $? -eq 0 ]; then echo "下载完成,正在执行 $FILE..." - node $FILE port=$PORT + PORT=$PORT node $FILE # 传递端口作为环境变量 else echo "下载失败" -fi \ No newline at end of file +fi