From 86347f7ffb806fb59def7200c1af1d6ab4509f53 Mon Sep 17 00:00:00 2001 From: ert Date: Fri, 19 Sep 2025 00:22:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=B8=80=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- baota_start.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/baota_start.js b/baota_start.js index 650b823..9605cba 100644 --- a/baota_start.js +++ b/baota_start.js @@ -1,7 +1,12 @@ // 宝塔环境下的Node项目启动脚本 -const { spawn } = require('child_process'); -const path = require('path'); -const fs = require('fs'); +import { spawn } from 'child_process'; +import path from 'path'; +import fs from 'fs'; +import { fileURLToPath } from 'url'; + +// 获取当前文件的目录路径 +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); // 获取项目根目录 const rootDir = __dirname;