Use ts-node locally from node_modules
See original GitHub issueHi,
I there a way to use ts-node cli tool locally (from node_modules) ?
I would like to be able to run node_modules/.bin/ts-node src/index.ts instead of using it globally.
This will help to manage deferent ts-node versions for deferent projects.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
ts-node - npm
Tip: Installing modules locally allows you to control and share the versions through package.json . ts-node will always resolve the compiler ...
Read more >Installation | ts-node - TypeStrong · GitHub
Tip: Installing modules locally allows you to control and share the versions through package.json. ts-node will always resolve the compiler from cwd before ......
Read more >How To Run TypeScript Scripts with ts-node - DigitalOcean
In this article you will learn how to run TypeScript scripts without the hassle of manually transpiling.
Read more >How to run a ts script installed in node_modules with ts-node
1 Answer 1 · Make sure that you have "esModuleInterop": true in both tsconfigs - in mypackage and in dependent project where you...
Read more >How to use TypeScript with Node.js - Section.io
When using Ts-node, make sure you have Typescript installed in your local project. To install it, run npm install -D typescript . Go...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I have found the solution in any case.
I didn’t noticed that the
"bin"file is located in thedistdirectory. I think that a"bin"file in thenode_modules/.bindirectory will be a bit more user friendly, but its semantics at this point.You can create an npm script in your project as follow:
And then call
Only drawback of this method is that you need to escape flags:
However, if you do not use flags like that (just a file name, for instance), you can simply do:
Hope this helps.