How to Reload web browser automatically when code changes [npm]

Reload web browser automatically using npm Command

If you are using HTTP-server than you might face problem for manually refresh the JavaScript, CSS, HTML files each and every time you change the code. This problem can be solved through command line using simple npm commands.

Note: This solution is for only for Windows users. Make sure you have node.js installed in your machine.

Step 1: Check if you install package.json file in your project directory. If not than follow this step. Open your cmd and set path to the project directory.

  • Go to Project directory
  • Run npm init command

  • Run npm install command

Step 2: Now you have the package.json file.

Step 3: Run command “npm install reload -g”

Step 4: Run command “reload -b”

Step 5: Above command automatically run web browser.
That’s all. Now each time you change your code the web browser automatically refresh with updated code. If you have any problem regarding to above installation. Kindly post your questions in comment section below. Happy Coding ?

Front-end Developer. Passionate about designing, digital marketing, writing, and tea. You can connect with me on social media by links given below.

Leave a Reply

Your email address will not be published. Required fields are marked *