Question: How can I run ts file through ts-node with global package installation?
For example i have typescript applicaton which i want to publish, and use it as a global package.

In the package.json file there is a bin property, where we can specify the command for our executable file, which after installation will set into the PATH variable.

In the case of the .js file, there is no problem.
You just need to specify the required file in bin.

![jsfile](https://imgur.com/DrNIER5.png)

After installation, scripts appear that launch our application using the command we specified in bin. Apparently from a screenshot, node.exe used our js. file as parameter

![jsresult](https://imgur.com/cEy8tvN.png)

But how to do the same with ts. fille?
I can run ts file using ts-node, which is installed in the local node\_modules

![tsrun](https://imgur.com/g6e5XHv.png)

But i can't do this with the bin property.
The screenshot below causes an error.

![error](https://imgur.com/bZ8UedC.png)

Need link to executable file. But by itself ts. cannot be executed without ts-node.

Is it possible to specify in bin that ts. file need to pass ts-node? Or solve this problem without a global installation of ts-node?

Answer: 
You may have to have a js entry file containing something like this:

```
#! /usr/bin/env node

require('ts-node').register();
require('./index.ts');

```
If you have `ts-node` installed globally, you can use the following to be executed as a ts-node scripts instead

```js
#! /usr/bin/env ts-node

const thing: string = 'world';
console.log(`Hello ${thing}`);

```