{"record":{"id":"f2c04116bfc3634a","repo":"garrytan/gstack","slug":"cannot-find-server-ts-set-browse-server-script-en","errorCode":null,"errorMessage":"Cannot find server.ts. Set BROWSE_SERVER_SCRIPT env or run from the browse source tree.","messagePattern":"Cannot find server\\.ts\\. Set BROWSE_SERVER_SCRIPT env or run from the browse source tree\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"browse/src/cli.ts","lineNumber":53,"sourceCode":"  // Dev mode: cli.ts runs directly from browse/src\n  // On macOS/Linux, import.meta.dir starts with /\n  // On Windows, it starts with a drive letter (e.g., C:\\...)\n  if (!metaDir.includes('$bunfs')) {\n    const direct = path.resolve(metaDir, 'server.ts');\n    if (fs.existsSync(direct)) {\n      return direct;\n    }\n  }\n\n  // Compiled binary: derive the source tree from browse/dist/browse\n  if (execPath) {\n    const adjacent = path.resolve(path.dirname(execPath), '..', 'src', 'server.ts');\n    if (fs.existsSync(adjacent)) {\n      return adjacent;\n    }\n  }\n\n  throw new Error(\n    'Cannot find server.ts. Set BROWSE_SERVER_SCRIPT env or run from the browse source tree.'\n  );\n}\n\nconst SERVER_SCRIPT = resolveServerScript();\n\n/**\n * On Windows, resolve the Node.js-compatible server bundle.\n * Falls back to null if not found (server will use Bun instead).\n */\nexport function resolveNodeServerScript(\n  metaDir: string = import.meta.dir,\n  execPath: string = process.execPath\n): string | null {\n  // Dev mode\n  if (!metaDir.includes('$bunfs')) {\n    const distScript = path.resolve(metaDir, '..', 'dist', 'server-node.mjs');\n    if (fs.existsSync(distScript)) return distScript;","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/garrytan/gstack/blob/94993f74012782fd94416dd44b8314f6363a13a4/browse/src/cli.ts#L35-L71","documentation":"Error \"Cannot find server.ts. Set BROWSE_SERVER_SCRIPT env or run from the browse source tree.\" thrown in garrytan/gstack.","triggerScenarios":"Thrown at browse/src/cli.ts:53 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"94993f74012782fd94416dd44b8314f6363a13a4","analyzedAt":"2026-08-12T04:06:23.140Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}