Skip to content

TypeScript compiler is crashing on next #5625

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
blakeembrey opened this issue Nov 11, 2015 · 2 comments · Fixed by #5628
Closed

TypeScript compiler is crashing on next #5625

blakeembrey opened this issue Nov 11, 2015 · 2 comments · Fixed by #5628
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@blakeembrey
Copy link
Contributor

It looks like it was introduced in e1b4f01#diff-233e1126c0abc811c4098757f9e4516eR2742, but I'm getting:

                 var path = sourceFile.path || ts.toPath(sourceFile.fileName, currentDirectory, getCanonicalFileName);
                                       ^
  TypeError: Cannot read property 'path' of undefined
      at sourceFileUpToDate (node_modules/typescript/lib/typescript.js:46061:38)
      at programUpToDate (node_modules/typescript/lib/typescript.js:46077:26)
      at synchronizeHostData (node_modules/typescript/lib/typescript.js:45958:17)
      at Object.getEmitOutput (node_modules/typescript/lib/typescript.js:49060:13)
      at getOutput (dist/ts-node.js:75:30)
      at compile (dist/ts-node.js:97:26)
      at Object.loader (dist/ts-node.js:110:27)
  ] to not exist
      at dist/ts-node.spec.js:9:2004
      at ChildProcess.exithandler (child_process.js:758:5)
      at maybeClose (child_process.js:1015:16)
      at Process.ChildProcess._handle.onexit (child_process.js:1087:5)

Reference: https://travis-ci.org/TypeStrong/ts-node/jobs/90594369

I went through the code and found that adding the default library path to the getScriptFileNames array fixes things. The specific case when the file is undefined is when ts-node is running over TypeScript, then JavaScript, and back to TypeScript. Might be able to occur on other loaders too, but I haven't investigated the root cause far enough yet. The two arrays compared for length on the previous line look like:

// Root file names according to TypeScript:
[ '/Users/blakeembrey/Projects/blakeembrey/ts-node/typings/ambient/main/node.d.ts',
  '/Users/blakeembrey/Projects/blakeembrey/ts-node/tests/complex/index.ts',
  '/Users/blakeembrey/Projects/blakeembrey/ts-node/tests/complex/foo.ts' ]

// File names in the source program:
[ '/Users/blakeembrey/Projects/blakeembrey/ts-node/node_modules/typescript/lib/lib.d.ts',
  '/Users/blakeembrey/Projects/blakeembrey/ts-node/typings/ambient/main/node.d.ts',
  '/Users/blakeembrey/Projects/blakeembrey/ts-node/tests/complex/index.ts' ]

Edit: Please let me know what other information is needed to narrow this down.

@mhegazy
Copy link
Contributor

mhegazy commented Nov 11, 2015

@vladima can you take a look?

@mhegazy mhegazy added the Needs More Info The issue still hasn't been fully clarified label Nov 11, 2015
@vladima
Copy link
Contributor

vladima commented Nov 12, 2015

good catch, thanks

@mhegazy mhegazy added Bug A bug in TypeScript Fixed A PR has been merged for this issue and removed Needs More Info The issue still hasn't been fully clarified labels Nov 12, 2015
@mhegazy mhegazy added this to the TypeScript 1.8 milestone Nov 12, 2015
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants