TypeScript: tsc command inside npm scripts causes npm to error out

TypeScript Version: 1.7.5 && nightly (1.9.0-dev.20160217) either one

https://github.com/npm/npm/issues/12412

Unsure if this is an Npm issue itself or something that tsc is doing that’s causing npms lifecycle to crash and error out.

To reproduce, simply try to run tsc when inside an npm script on Windows.

In my example I have:

"scripts" : {
    "build-ts" : "tsc"
}

When running:

npm run build-ts

It runs typescript compiler and all of that seems to work fine. After, it seems to error out (causing any further scripts to never run as well) Note: tsc alone when ran in the console works fine.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 6
  • Comments: 33 (8 by maintainers)

Commits related to this issue

Most upvoted comments

I think the easiest way is to just do “tsc || true” for your prestart script there @deanrih that’ll let it continue

if an error is reported, the return code is non-zero to indicate that the compilation failed. this is needed for other build tool chains.

Try tsc @tscfiles || echo done.

It runs typescript compiler and all of that seems to work fine. After, it seems to error out (causing any further scripts to never run as well)

not sure i understand. locally npm run build-ts seems to work fine for me. what are you seeing? what errors do you get?