diff --git a/server/scripts/run-local.ts b/server/scripts/run-local.ts index e5245ebf..7e954d55 100644 --- a/server/scripts/run-local.ts +++ b/server/scripts/run-local.ts @@ -9,7 +9,10 @@ async function startServerAndRunScript() { console.log('MongoDB Memory Server started:', mongoUri); // 通过 spawn 运行另一个脚本,并传递 MongoDB 连接 URL 作为环境变量 - const tsnode = spawn('cross-env', [`xiaojuSurveyMongoUrl="${mongoUri}"`, 'npx', 'ts-node-dev', './src/index.ts']) + const tsnode = spawn('cross-env', [`xiaojuSurveyMongoUrl="${mongoUri}"`, 'npx', 'ts-node-dev', './src/index.ts'], { + stdio: 'inherit', + shell: process.platform === 'win32' + }); tsnode.stdout?.on('data', (data) => { console.log(data.toString()); });