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