Ts-node: Unexpected token ' in JSON at position 0

Created on 12 Jun 2019  路  5Comments  路  Source: TypeStrong/ts-node

ts-node -O '{"module": "commonjs"}' ./scripts/generateTranslationFiles.ts
undefined:1
'{module:
^

SyntaxError: Unexpected token ' in JSON at position 0

What i'm doing wrong?

Most helpful comment

When using Win10 cmd, you need to use three double quotes to represent the original double quotes.

All 5 comments

What shell are you using? Any other information to debug? This seems like an issue with your environment in some way.

Since you ask me for that i tried to run that command in many differents ways.

I work on Windows 10, and i tried to run ts-node -O '{"module": "commonjs"}' ./scripts/generateTranslationFiles.ts in _PowerShell_ and traditional _CMD_. That doesn't work.

Thanks in advance.

Did you try using double quotes and escaping? IIRC Windows shells act differently in terms of quotes.

Thanks for your quick response. I solve this issue using the new ubuntu subsystem for Windows. Thanks you a lot.

When using Win10 cmd, you need to use three double quotes to represent the original double quotes.

Was this page helpful?
0 / 5 - 0 ratings