ts-node-dev sometimes uses old versions of files for compilation
See original GitHub issueI am seeing ts-node-dev fail to hot reload files sometimes (even though it notices the file changes and tries to restart according to the output). I don’t have any steps to repro and I’m seeing this randomly every 2-3 days.
It seems different enough from the other issues i’ve seen on here to make its own thread.
I will fully explain my workflow for the most recent case as it may shed some light.
the error looked like:
[INFO] 15:58:29 Restarting: /Users/ryan/app_engine/StoryDoodle/src/server/util/redis.ts has been modified
Using ts-node version 8.0.2, typescript version 3.3.3333
[ERROR] 15:58:32 ⨯ Unable to compile TypeScript:
src/server/cache/JSONCache.ts(5,34): error TS2551: Property 'getAsync' does not exist on type 'IPromisifedRedis'. Did you mean 'hmgetAsync'?
src/server/cache/JSONCache.ts(16,17): error TS2339: Property 'setAsync' does not exist on type 'IPromisifedRedis'.
This is a normal and explainable error but it was only possible with an old file of /util/redis.ts because that’s the only time I had hmgetAsync type defined. In addition, other files which depend on this file are compiling correctly. (they should fail on that version of the file)
My flow:
- Make /util/redis.ts with version A (which would not have this error)
- Make another file that debends on and works with /util/redis.ts
- Modify /util/redis.ts to version B (which should produce this error)
- Change my mind and change /util/redis.ts back to version A
- Compilation is fine.
- Create a new file that depends on /util/redis.ts
- Get this error (which could only occur on version B of /util/redis.ts)
- Try to resolve error by editing files. This causes visible reloads but error still persists
- Restarting ts-node-dev by killing and re-running compiles properly
my command: ts-node-dev --respawn src/server/index.ts OS: MAC OSX 10.14 ts-node-dev version: 1.0.0-pre.32
I can do additional debugging the next time this happens. Just let me know what might help.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:22
- Comments:19 (5 by maintainers)
Top Related StackOverflow Question
Also experiencing this issue. My reproduction steps are basically the same as the issue author.
Here’s the simplified version:
This is extremely annoying to deal with and results in having to restart the compilation quite often, which can take close to a minute.
I’ve been running into this too, except fairly frequently (on windows). It seems like every time I change a function signature or add a new file, I need to restart the process or it throws errors.