TypeScript在Windows操作系统上的编译错误。

huangapple go评论98阅读模式
英文:

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 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.

答案1

得分: 2

我找到了一个解决方法,不指定编译器路径,并使用以下命令在Windows上运行它:

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

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

huangapple
  • 本文由 发表于 2023年1月4日 07:09:27
  • 转载请务必保留本文链接:https://go.coder-hub.com/74999533.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定