Search code examples
node.jstypescriptwindowspackage.jsontsc

TypeScript compilation error on windows OS


I have created a command in package.json using tsc-watch which is shown below:

npx tsc-watch --noClear --compiler ./node_modules/.bin/tsc --onSuccess 'node ./dist/src/index.js'

This works perfectly fine on mac but when I run it inside windows it throw below error:

\node_modules\.bin\tsc:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
          ^^^^^^^

SyntaxError: missing ) after argument list

Not sure if there is anything wrong with compiler path or anything I am missing.

Thanks in advance.


Solution

  • I found a workaround by not specifying the compiler path and used below command to run it on windows:

    "npx tsc-watch --noClear --onSuccess \"node ./dist/src/index.js\""