I’m using nodemon on my physical OSX host to rerun tests when files change.
This is not working for me, and looking at some other threads, it might be due to:
The virtual machine docker host (run with docker-machine).
nodemon not working with docker.
Watching files not working with docker.
I’m having a real hard time to know in what direction to go. The whole idea is to develop in the docker container, so not having watch mode is a dealbreaker here.
How do I go forward? Should I go into the virtual machine instead of using docker-machine? Should I expose a shared directory somehow? Replace nodemon? Replace docker?
Update:
I followed below guide, and remade some code. At first docker-compose up, nodemon magically worked for me. github.com/marcusnielsen/rxjs-server for reference code. Check open branches/PRs, but otherwise I might have merged the setup to master already.
To me the original issue sounds like filesystem notifications – they don’t really work with VirtualBox shared folders as far as I’m aware (so e.g. nodemon is listening for FS events on the Linux end, but the native Mac save events don’t get propagated through vboxfs into the Linux VM).
I would be curious to know what you did to get it working? I do think that some projects like nodemon have a poll-based backup when FS events are unavailable, but I don’t know how common it is.
In some networked environments (such as a container running nodemon reading across a mounted drive), you will need to use the legacyWatch: true which enables Chokidar’s polling.
And they also saying that it should be a last resort as it will poll every file it can find.