MOCKSTACKS
EN
Questions And Answers

More Tutorials









NodeJS Autoreload on changes

Autoreload on source code changes using nodemon


The nodemon package makes it possible to automatically reload your program when you modify any file in the source code.

Installing nodemon globally


npm install -g nodemon (or npm i -g nodemon)

Installing nodemon locally


In case you don't want to install it globally

npm install --save-dev nodemon (or npm i -D nodemon)

Using nodemon


Run your program with nodemon entry.js (or nodemon entry)

This replaces the usual use of node entry.js (or node entry).

You can also add your nodemon startup as an npm script, which might be useful if you want to supply parameters and not type them out every time.

Add package.json:


 "scripts": {
 "start": "nodemon entry.js -devmode -something 1"
 }

This way you can just use npm start from your console.

Conclusion

In this page (written and validated by ) you learned about NodeJS Autoreload on changes . What's Next? If you are interested in completing NodeJS tutorial, your next topic will be learning about: NodeJS Environment.



Incorrect info or code snippet? We take very seriously the accuracy of the information provided on our website. We also make sure to test all snippets and examples provided for each section. If you find any incorrect information, please send us an email about the issue: mockstacks@gmail.com.


Share On:


Mockstacks was launched to help beginners learn programming languages; the site is optimized with no Ads as, Ads might slow down the performance. We also don't track any personal information; we also don't collect any kind of data unless the user provided us a corrected information. Almost all examples have been tested. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. By using Mockstacks.com, you agree to have read and accepted our terms of use, cookies and privacy policy.