Assuming you rather not install ts-node locally and would prefer to use the globally installed node_module. The following examples show what to do for Windows and assumes you're using NVM. If not using NVM, replace NVM_SYMLINK with C:\Program Files\nodejs
Example for command line:
node -r "%NVM_SYMLINK%\node_modules\ts-node\register" script.ts arg1 arg2
Example for bash:
node -r "$NVM_SYMLINK/node_modules/ts-node/register" script.ts arg1 arg2
Example for vscode launch.config
"configurations": [
{
"name": "utils/roll_browser",
"type": "node",
"request": "launch",
"runtimeArgs": [
"-r",
/* Slower startup. Runs full typescript validation */
// "${env:NVM_SYMLINK}/node_modules/ts-node/register"
/* Faster startup. Doesn't check types or verify the code is valid */
"${env:NVM_SYMLINK}/node_modules/ts-node/register/transpile-only"
],
"args": ["${workspaceFolder}/utils/roll_browser.ts", "chromium", "756141"],
},
]