ts-node with shebang vs ts-node-script #1186
-
I posted this question #1007 (comment) and was suggested to ask it here. I didn't quite understand the response I got.
So I thought that running Example:
Both scripts uses
What am I missing? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
It sounds like some confusion around the shebang rather than To have your environment use the shebang, you’d invoke the script without node. For example, just do |
Beta Was this translation helpful? Give feedback.
-
Oh yea total misunderstanding of the shebang. |
Beta Was this translation helpful? Give feedback.
It sounds like some confusion around the shebang rather than
ts-node
. If I’m understanding the question correctly, you expectedts-node x.ts
to automatically use the shebang? When running something withts-node
(ornode
) it doesn’t use the shebang anymore, it’s a feature of your Unix environment rather than the programming language.To have your environment use the shebang, you’d invoke the script without node. For example, just do
./shebang.ts
.