Dandré
Dandré

Reputation: 2173

I have a ' "tsc.exe" exited with code 1 ' error, how do I troubleshoot?

Let me explain where I'm coming from. I'm doing builds on Azure DevOps Pipelines which involves running either Typescript 2.6.2 or Typescript 3.1 compilations. I can't upgrade the older code bases to use Typescript 3.1 so I need to run different versions.

I keep getting errors like this (which happens at random):

packages\Microsoft.TypeScript.MSBuild.2.6.5\tools\Microsoft.TypeScript.targets(438,5): Error MSB6006: "tsc.exe" exited with code 1.

That is all that tsc.exe is giving me. Nothing more. I have already followed the advice of installing Microsoft.TypeScript.MSBuild as a nuget package for the project that needs to use an earlier version of Typescript 3. I've also taken out these lines as advised:

< Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props')" />

< Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets')" />

Now that it no longer tries to compile against Typescript 3.1, I still get the error above without any useful errors (or ability to set the kind of output that I want), it happens at random and I am really at wits end. I've done the same kind of compilation runs on my local machine unable to replicate the problem. I would really appreciate advice on how to tackle this problem.

UPDATE:

We've been running two environments with the exact same arguments (the other environment is our on premise build server that we're moving away from that's running Team City) and only the DevOps one is behaving erratic. I then decided to see if the /m /nr:false parameters that we're passing to MSBuild could have any effect and indeed, the odds moved into our favor when I took it out on DevOps. I ran 8 builds on the exact same source commit and exact same build definition settings (with no noticeable changes in build performance) and only once did it fail (again, tsc.exe being very vague). So it seems as if multiple threads/processes have interfered on the Pipeline builds. But I would still like to know what else I can do to figure out what is really going on.

Upvotes: 2

Views: 748

Answers (1)

Dandr&#233;
Dandr&#233;

Reputation: 2173

I finally found a way to get some feedback! Turns out its not Typescript per say but VSTS from the MSBuild that is not giving me what I want.

I found an article that shows that Visual Studio is able to give more feedback. Which got me wondering if there was a way to do that for MSBuild.

Turns out there are some command line arguments that you can pass to MSBuild. So I tried this:

/consoleloggerparameters:NoItemAndPropertyList /verbosity:diagnostic

Then MSBuild failed with the following output:

d:\a\1\s\packages\Microsoft.TypeScript.MSBuild.2.6.5\build\\..\tools\tsc\tsc.exe --project "d:\a\1\s\MyApp\wwwroot\App\tsconfig.json" --listEmittedFiles (TaskId:1413)
  Unknown output: Script failed with error: 'JsErrorScriptException (0x30001)'. (TaskId:1413)
  Unknown output: Out of stack space (TaskId:1413)
  Unknown output:    at runWithCancellationToken (Unknown script code:58193:17) (TaskId:1413)
  Unknown output:    at emit (Unknown script code:58108:13) (TaskId:1413)
  Unknown output:    at compileProgram (Unknown script code:61904:9) (TaskId:1413)
  Unknown output:    at performCompilation (Unknown script code:61881:9) (TaskId:1413)
  Unknown output:    at executeCommandLine (Unknown script code:61856:17) (TaskId:1413)
  Unknown output:    at Global code (Unknown script code:62078:1) (TaskId:1413)

Finally I have what I was looking for. A way to figure out how to troubleshoot Typescript compilation errors from MSBuild!

Upvotes: 2

Related Questions