I was having the same problem and fixed using one of the following two ways.
ts-node"
in your tsconfig.json
as follows {
"ts-node": {
"files": true
},
"compilerOptions": {
...
},
"include": ["src/**/*.ts", "src/types/**/*.d.ts"],
"exclude": ["node_modules", "dist"]
}
2. in your package.json
add --files
option as follows
"scripts": {
"start": "node dist/app.js",
"dev": "nodemon --files src/app.ts"
},
for more details you can see https://stackoverflow.com/a/62878548/22229159 and https://stackoverflow.com/a/51666714/22229159