I did exactly the same thing that all the responses to this post are saying.
But I achieved a solution with a simple command, in addition to the previous solutions
In the script you need to put "--files"
"scripts": { "dev": "ts-node-dev --respawn --env-file=.env --files src/index.ts",