Node.js Development With Vagrant And Nodemon

less than 1 minute read

Today i've encountered a strange behaviour which makes Node development on a Vagrant box a bit struggling. The reason is that if you are using Nodemon on your Vagrant box to restart your process ( e.g your Express app ) on file changes sometimes it's not even detecting the changes correctly or taking too long.

nodemon -L app.js

After some digging i've found that you can use Nodemon with -L option to detect the changes on the Vagrant box. But as others reported it didn't work for me and cause the process to restart continuously.

As an alternative to Nodemon you can use Supervisor which basically does the same stuff. And works correctly on file changes.

To get Supervisor from npm

sudo npm install -g supervisor

To start your process with Supervisor

supervisor app.js

P.s : Supervisor can also take up to 3-4 seconds to restart and sync file changes.

 

Leave a Comment