ts-node-dev: Application fail to respawn after file modification has been detected

Issue description

The application fails to respawn after a few restarts: command :

cross-env NODE_ENV=development ts-node-dev --debug --files --respawn --project tsconfig.json --transpile-only --inspect --watch .env,../common/src, -- src/devIndex.ts

INFO] 17:58:00 Restarting: ../app/src/langConsts.ts has been modified
[DEBUG] 17:58:00 ../snip_common/src/langConsts.ts compiled in 184 ms
[DEBUG] 17:58:00 Removing all watchers from files
[DEBUG] 17:58:00 Child is still running, restart upon exit
[DEBUG] 17:58:00 Disconnecting from child
[DEBUG] 17:58:00 Sending SIGTERM kill to child pid 79198
[2021-01-09T17:58:00.471] [INFO] expressApp.ts - Shutting down...
About to exit with code: 143
Assertion failed: (napi_create_string_utf8(env, events->events[idx].path, NAPI_AUTO_LENGTH, &args[0]) == napi_ok), function fse_dispatch_event, file ../src/fsevents.c, line 147.
npm ERR! code 1
npm ERR! path /Users/bobbui/Documents/app/packages/backend
npm ERR! command failed
npm ERR! command sh -c cross-env NODE_ENV=development ts-node-dev --debug --files --respawn --project tsconfig.json --transpile-only --inspect --watch .env,../common/src,  -- src/devIndex.ts

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/bobbui/.npm/_logs/2021-01-10T01_58_00_658Z-debug.log

I think the most relevant part is Assertion failed: (napi_create_string_utf8(env, events->events[idx].path, NAPI_AUTO_LENGTH, &args[0]) == napi_ok), function fse_dispatch_event, file …/src/fsevents.c, line 147.

but a quick Google search returns absolutely nothing 😢

Context

OS version (is it docker or host?), ts-node-dev version Mac OS 10.15.7 ts-node-dev@1.1.1 node v15.4.0 Did you try to run with ts-node? yes Did you try to run with --files option enabled? yes Did you try to run with --debug option enabled? yes Do you have a repro example (git repo) with simple steps to reproduce your problem? no

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 22
  • Comments: 21 (2 by maintainers)

Most upvoted comments

There were reports on this https://github.com/wclr/ts-node-dev/issues/241 not sure what it may be caused by. This also probably affects MacOs users. Try to use --poll option.

Still having the same issue on v1.1.6.

There were reports on this #241 not sure what it may be caused by. This also probably affects MacOs users. Try to use --poll option.

This works well. Thanks @wclr

@bobbui I feel your pain. As temporary workaround I rolled back from 1.1.1 to 1.1.0, problem gone.

Revert to 1.1.0 does not work for me.

If you still have this issue on macOS it is likely related to fsevents

Version 2.3.2 or newer should fix it, see here: https://github.com/fsevents/fsevents/pull/356

Fix:

npm update fsevents

(I can confirm it works on my environment)

Same here within a nuxt(https://nuxtjs.org/) project. I had to upgrade a few dependencies, but nothing really crucial and since today it’s randomly throwing those errors while being in watch mode for compilation. Upon some changes everything’s compiling just fine, sometimes it pops up out of the blue. Haven’t noticed any pattern.

Assertion failed: (napi_create_string_utf8(env, events->events[idx].path, NAPI_AUTO_LENGTH, &args[0]) == napi_ok), function fse_dispatch_event, file ../src/fsevents.c, line 147.

For the people that are still having this problem, the alternative solution suggested here worked for me: https://github.com/wclr/ts-node-dev/issues/258

Any progress on this one? --poll works but is quite CPU intensive

Can confirm, still an issue:

[0] Assertion failed: (napi_create_string_utf8(env, events->events[idx].path, NAPI_AUTO_LENGTH, &args[0]) == napi_ok), function fse_dispatch_event, file ../src/fsevents.c, line 147.
[0] error Command failed with signal "SIGABRT".
[0] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[0] yarn start:dev exited with code 1
interrupt: 2
~/w/u/api:develop* λ yarn list ts-node-dev chokidar
yarn list v1.22.10
warning Filtering by arguments is deprecated. Please use the pattern option instead.
├─ chokidar@3.5.1
└─ ts-node-dev@1.1.6