npm live-server not auto-reloading

live server not working
live-server github
npm live reload
auto refresh server
vscode live server javascript
live server ubuntu
express live reload
vscode-live server php

I have tried to work on the live server, installed a node package called live-server by using this command: npm install -g live-server

It worked fine, installed successfully and run live-server by live-server command.

Whenever I change my code and save on code editor, the browser won't refresh automatically.

Here is my package.json file:

"name": "nodejs",
  "version": "1.0.0",
  "description": "",
  "main": "app.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "Abul Khoyer",
  "license": "ISC"
}

I had the same problem as you and managed to get it working by making sure that the .html-file was properly formatted. I.e. like this:

<!DOCTYPE html>
<html>
<body>
    <h1>Script tester!</h1>
    <script type="text/javascript" src="script.js"></script>
</body>
</html>

live-server, simple development http server with live reload capability. 0.0.0.0 ("any address"); --no-browser - suppress automatic web browser launching  Live server would serve the file in the browser, but it would not refresh the browser automatically upon saving the file. What I've tried: Unistalled live server

You need to add this code: for

Usage from node

Example:

var liveServer = require("live-server");

var params = {
    port: 8181, // Set the server port. Defaults to 8080.
    host: "0.0.0.0", // Set the address to bind to. Defaults to 0.0.0.0 or process.env.IP.
    root: "/public", // Set root directory that's being served. Defaults to cwd.
    open: false, // When false, it won't load your browser by default.
    ignore: 'scss,my/templates', // comma-separated string for paths to ignore
    file: "index.html", // When set, serve this file for every 404 (useful for single-page applications)
    wait: 1000, // Waits for all changes, before reloading. Defaults to 0 sec.
    mount: [['/components', './node_modules']], // Mount a directory to a route.
    logLevel: 2, // 0 = errors only, 1 = some, 2 = lots
    middleware: [function(req, res, next) { next(); }] // Takes an array of Connect-compatible middleware that are injected into the server middleware stack
};
liveServer.start(params);

Or else you can add a file .live-server.json :

If that exists it will be loaded and used as default options for live-server on the command line.

For more details see: https://www.npmjs.com/package/live-server

Live Server not reloading to display new changes · Issue #236 , Live Server does not reload changes anymore, It only reloads and still show previous view, I would have to The auto reloading is not consistent. try to delete node_modules and install then.. npm i or yarn install чт, 5 дек. npm / npm Archived. Watch 857 Star 17.2k Fork 3.2k Code. Issues 2,167. Pull requests 0. Actions Security "ng serve" is not auto reloading #16915. Closed

Use NPM To Install A Package Called PM2.

NPM is a package manager that you will use to install frameworks and libraries to use with your Node.js applications. NPM was installed with Node.js. PM2 is a sweet little tool that is going to solve two problems for you:

  1. It is going to keep your site up by restarting the application if it crashes. These crashes should NOT happen, but it is good know that PM2 has your back. (Some people may be aware of Forever.js, another tool that is used to keep node based sites running - I think you will find that PM2 has a lot to offer.)

  2. It is going to help you by restarting your node application as a service every time you restart the server. Some of use know of other ways to do this, but pm2 makes it easier, and it has some added flexibility.

Install PM2 by typing thr following at the command line:

sudo npm install pm2 -g

You can follow this line to setup Nodejs production environment: https://www.digitalocean.com/community/tutorials/how-to-use-pm2-to-setup-a-node-js-production-environment-on-an-ubuntu-vps

Installing Node.js live-server · GitHub, The NodeJS live-server package runs a temporary server displaying any HTML/​CSS/JS resources in the It automatically reloads the page in your browser when any of these files change. If not, follow the instructions at nodejs.org to install. Live Server does not reload changes anymore, It only reloads and still show previous view, I would have to reload manually to get my new changes showing. Expected behavior. Once I return to the browser, server ought to reload and show new changes. Environment

If you're working on Windows 10 like myself, it's likely that your directory name is too long like this:

C:\Users\Del\Documents\Web Development Works\JS Exercises[books]\Learning JavaScript\lj

Just try to move your directory to Desktop so it will be much shorter like this:

C:\Users\Del\Desktop\lj

In my case, the auto-reload of live-server is working after I move my directory to Desktop

npm live-server not auto-reloading - node.js - html, I have tried to work on the live server, installed a node package called live-server by using this command: npm install -g live-server It worked fine, installed  Issue the command live-server in your project's directory. Alternatively you can add the path to serve as a command line parameter. This will automatically launch the default browser. When you make a change to any file, the browser will reload the page - unless it was a CSS file in which case the changes are applied without a reload.

Check your script tag in html file. don't close your tag as empty element like this < /> . This was preventing my browser to load page automatically. close it properly <> .

Start a local, live-reload web server with one command, The server we'll use features live-reload, which means when you make a change to your code, your browser will refresh automatically! Oh, you also Next let's use npm to install our server application, Browsersync! This is In case that one also doesn't exist, just create it and we'll make the changes there. Heya, there are a few reports of live reloading not working properly but they are heavily dependent on the system and setup. My advice is to have a look at the existing issue on this topic ( #1610 ), perhaps some of the fixes suggested there apply to your case.

Settings | Live Server, liveServer.settings.root : To change root of server in between workspace And also, it does not matter if your HTML have <body> tag or not, Live Reload will Live Server is smart enough, it'll eigher ask what you want or automatically set the  Start a local, live-reload web server with one command. Honestly, this is all you need to start developing and test across multiple browsers and devices! Scott Vinkle. Node.js and npm.

nodemon, nodemon reload, automatically. Nodemon is a utility that will monitor for any changes in your source and automatically restart your server. Perfect for  Why webpack-dev-server Live-Reload Is Not Working. Soon Hin Khor, Ph.D. but browser is not auto-reloading. Manually reloading the web page picks up code change. The most confusing things

Live Server, that is typically designed to provide access to geo-referenced scientific data. It can present distributed data sets as a unified virtual database. Installing Node.js live-server. The NodeJS live-server package runs a temporary server displaying any HTML/CSS/JS resources in the current folder. It automatically reloads the page in your browser when any of these files change. OS X. Verify that Node.js is installed. If you see anything when you run which npm in a terminal, it is.

Comments
  • Have you added .live-server.json file?
  • In addition, any element you create should also adhere to the "correct" html formatting. It doesn't seem to like a self-closing tag like <hr/> or <br/>.
  • thanks, but I have tried this way. still not working.
  • app.js is blank. only console.log("hello world"); because I'm just testing.
  • That's wrong. Because when you publish your project to host, there is no Desktop location.