ts-node: ts-node executable hangs, won't enter repl
I never reach the repl, only ts-node -h
works, I can’t even print a version.
maybe some useful debugging information?
kshah ~ npm install -g ts-node
/Users/kshah/.nvm/versions/node/v8.9.4/bin/ts-node -> /Users/kshah/.nvm/versions/node/v8.9.4/lib/node_modules/ts-node/dist/bin.js
+ ts-node@7.0.1
updated 1 package in 1.427s
kshah ~ which ts-node
/Users/kshah/.nvm/versions/node/v8.9.4/bin/ts-node
kshah ~ which npm
/Users/kshah/.nvm/versions/node/v8.9.4/bin/npm
kshah ~ npm --version
6.4.1
kshah ~ node --version
v8.9.4
It appears to failing here:
ts.parseJsonConfigFileContent(config, ts.sys, basePath, undefined, configFileName);
which is a call made in readConfig
the arguments provided to this parseJsonConfigFileContent
function are as follows:
{ config:
{ compilerOptions:
{ sourceMap: true,
inlineSourceMap: false,
inlineSources: true,
declaration: false,
noEmit: false,
outDir: '$$ts-node$$' } },
'ts.sys':
{ args: [],
newLine: '\n',
useCaseSensitiveFileNames: false,
write: [Function: write],
writeOutputIsTTY: [Function: writeOutputIsTTY],
readFile: [Function: readFile],
writeFile: [Function],
watchFile: [Function],
watchDirectory: [Function: watchDirectoryUsingFsWatch],
resolvePath: [Function: resolvePath],
fileExists: [Function: fileExists],
directoryExists: [Function: directoryExists],
createDirectory: [Function: createDirectory],
getExecutingFilePath: [Function: getExecutingFilePath],
getCurrentDirectory: [Function: getCurrentDirectory],
getDirectories: [Function: getDirectories],
getEnvironmentVariable: [Function: getEnvironmentVariable],
readDirectory: [Function: readDirectory],
getModifiedTime: [Function: getModifiedTime],
setModifiedTime: [Function: setModifiedTime],
deleteFile: [Function: deleteFile],
createHash: [Function: createMD5HashUsingNativeCrypto],
createSHA256Hash: [Function: createSHA256Hash],
getMemoryUsage: [Function: getMemoryUsage],
getFileSize: [Function: getFileSize],
exit: [Function: exit],
realpath: [Function: realpath],
debugMode: false,
tryEnableSourceMapsForHost: [Function: tryEnableSourceMapsForHost],
setTimeout: { [Function: setTimeout] [Symbol(util.promisify.custom)]: [Function] },
clearTimeout: [Function],
clearScreen: [Function: clearScreen],
setBlocking: [Function: setBlocking],
bufferFrom: [Function: bufferFrom],
base64decode: [Function: base64decode],
base64encode: [Function: base64encode] },
basePath: '/Users/kshah',
configFileName: undefined }
That’s as far as I’ve taken the debug. Hoping someone can point me in the right direction
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 17 (7 by maintainers)
Interesting, I suppose the first makes more sense if the goal is to mock tsc, however, I think of REPLs as interactive playgrounds first, so I still think the second is best.
Because it hangs? and provides no error message? Are we seriously debating whether launching an executable and it not doing anything, not returning access to the REPL, and not failing is okay behaviour? I must be missing something here
I think it addresses that. It just loads the default REPL without any config. This issue was a problem with TypeScript treating no file input as search all directories. If you do
ts-node
in a project or empty directory, you’d see the expected behaviour.That makes sense. Generally it is an option because I tried to make
ts-node
mirrortsc
. By default it resolvestsconfig.json
liketsc
recursively upward. When it fails to find anything,tsc
would normally error out and print the “help” dialog. Which option do you prefer:tsc
, fail when notsconfig.json
file is found.tsconfig.json
file is found, use an in-memorytsconfig.json
file withfiles: []
(so it won’t fall back to the current behaviour of traversing everything in the cwd)