简体   繁体   中英

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.

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\""

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM