I am following a tutorial and the guy uses ts-node, so I did the same and installed it through yarn but it showed this error
ts-node : The term 'ts-node' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ ts-node .\deploy.ts
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (ts-node:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
so I searched a bit and tried to add it globally but it still shows the same error, can you guys help me find out what the issue is, as I want to learn the basics of TypeScript for a quiz tomorrow.
If you are running it just after installation, the console could be missing PATH. Restart your console (or, in my case, VSCode), to get newer executables working
If the yarn global installations don't work, try using
Install locally, as a yarn add --dev ts-node
dependency, and run as yarn ts-node
. Generally the simpliest solution.
Honestly, try using tsx
, it's better IMO
Just yarn tsx watch deploy
would be enough to make your server restart on every file change (I generally add some chechs so the script skips writing if that's file overwrite or deploy script)