How to restart Node upon changing a file?

Sometimes, we want to restart Node upon changing a file.

In this article, we’ll look at how to restart Node upon changing a file.

How to restart Node upon changing a file?

To restart Node upon changing a file, we can use the supervisor package.

We install it by running

npm install supervisor -g

Then we can watch for file changes in the Node project with entry point app.js by running

supervisor app.js

Conclusion

To restart Node upon changing a file, we can use the supervisor package.