Skip to content

Commit 2315ea2

Browse files
author
Giovanni Cerqui | NET GmbH
committed
chore: resolve ts-node loader path and require deps for viv-debug
Fixes ERR_MODULE_NOT_FOUND for ts-node by: - Pointing --loader to node_modules/ts-node/esm.mjs explicitly - Running from repo root (pushd) - Logging a clear error if node_modules is missing Now viv-debug.cmd works without global ts-node.
1 parent e751784 commit 2315ea2

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

build/windows/viv-debug.cmd

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ set "INSTALL_DIR=%~dp0..\..\"
88
set "LOG_PATH=%TEMP%\vivify-server.log"
99
set "OUT_LOG=%TEMP%\vivify-server.out.log"
1010
set "ERR_LOG=%TEMP%\vivify-server.err.log"
11+
set "TS_NODE_LOADER=%INSTALL_DIR%node_modules\ts-node\esm.mjs"
1112
1213
echo [%DATE% %TIME%] viv-debug starting > "%LOG_PATH%"
1314
@@ -22,13 +23,22 @@ if not exist "%INSTALL_DIR%src\app.ts" (
2223
exit /b 1
2324
)
2425
26+
if not exist "%TS_NODE_LOADER%" (
27+
echo [%DATE% %TIME%] ERROR: ts-node loader not found at %TS_NODE_LOADER% >> "%LOG_PATH%"
28+
echo [%DATE% %TIME%] Run: yarn install (or npm install) in %INSTALL_DIR% >> "%LOG_PATH%"
29+
exit /b 1
30+
)
31+
2532
set "VIV_LOG_PATH=%LOG_PATH%"
2633
set "VIV_TIMEOUT=0"
2734
set "NODE_ENV=development"
2835
36+
pushd "%INSTALL_DIR%"
37+
2938
rem Run server from source (uses ts-node loader) and capture stdout/stderr
30-
start /b "" node --loader ts-node/esm "%INSTALL_DIR%src\app.ts" %* > "%OUT_LOG%" 2> "%ERR_LOG%"
39+
start /b "" node --loader "%TS_NODE_LOADER%" "%INSTALL_DIR%src\app.ts" %* > "%OUT_LOG%" 2> "%ERR_LOG%"
3140
3241
echo [%DATE% %TIME%] viv-debug launched ts-node server >> "%LOG_PATH%"
3342
43+
popd
3444
endlocal

0 commit comments

Comments
 (0)