Registry / devops / gulp-live-server

gulp-live-server

JSON →
library0.0.31jsnpmunverified

gulp-live-server is a lightweight Gulp plugin designed to provide a development server with integrated live-reloading capabilities for static assets or Node.js applications. It abstracts the complexities of setting up a web server (potentially using `connect` or `express` internally) and a separate LiveReload server (via `tiny-lr`), allowing developers to quickly spin up a server and have their browser automatically refresh upon file changes. The package offers methods for serving static files, running a custom Node.js script as the server, and notifying the browser of updates. Despite its utility, the package is largely unmaintained, with its last release (version 0.0.31) dating back over 7 years to July 2017. Users should be aware of potential compatibility issues with newer Node.js versions or modern Gulp setups, especially those using ES Modules.

npm install gulp-live-server
INSTALL
IMPORT
SIG · GULP-LIVE-SERVER
G
gulp-live-server
devopsjavascriptv0.0.31
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

gls
const gls = require('gulp-live-server');
import gls from 'gulp-live-server';
The package is CommonJS-only. Use `require()` for the main plugin instance.
gls.static
const server = gls.static('public');
import { static } from 'gulp-live-server';
This method creates a server for serving static files. The package does not support ES Module named imports.
gls.new
const server = gls.new('myapp.js');
import { new } from 'gulp-live-server';
This method starts a server by running a custom Node.js script. The package does not support ES Module named imports.

This quickstart demonstrates how to set up `gulp-live-server` to serve static files from one or multiple directories and configure live-reloading upon file changes.

const gulp = require('gulp'); const gls = require('gulp-live-server'); gulp.task('serve-static', function() { // 1. Serve with default settings (serves 'public' folder on port 3000) const server = gls.static(); server.start(); // 2. Serve at a custom port for 'dist' folder const customPortServer = gls.static('dist', 8888); customPortServer.start(); // 3. Serve multiple folders const multiFolderServer = gls.static(['dist', '.tmp']); multiFolderServer.start(); // Use gulp.watch to trigger server actions (notify, start or stop) gulp.watch(['static/**/*.css', 'static/**/*.html'], function (file) { server.notify.apply(server, [file]); customPortServer.notify.apply(customPortServer, [file]); multiFolderServer.notify.apply(multiFolderServer, [file]); }); }); // To run: `gulp serve-static`
Debug
Known issues
breakingThis package is CommonJS-only and does not support ES Modules. Attempting to import it directly in an ESM context (e.g., `"type": "module"` in `package.json` or `.mjs` files) will result in import errors.
fix
Ensure your `gulpfile.js` uses CommonJS `require()` syntax. If your project uses ESM for other parts, you may need to keep `gulpfile.js` as a `.js` file without `"type": "module"` set, or restructure your Gulp setup to handle CJS dependencies.
affects: >=0.0.31
gotchaWhen restarting the server via `gulp.watch`, directly binding `server.start` might lead to a `TypeError: Bad argument` due to how `ChildProcess.spawn` handles the `this` context.
fix
Wrap `server.start.bind(server)` in an anonymous function to ensure correct context: `gulp.watch('myapp.js', function() { server.start.bind(server)() });`.
affects: >=0.0.31
gotchaThis package is effectively abandoned, with its last release over 7 years ago. It may contain unpatched security vulnerabilities, suffer from compatibility issues with newer Node.js versions or dependencies, and is not actively maintained. Consider modern alternatives.
fix
Evaluate alternative Gulp plugins for live-reloading and static servers, such as `browser-sync` or `gulp-connect`, which are actively maintained and provide similar or enhanced functionality for modern development workflows.
affects: >=0.0.31
Errors
Common errors & fixes
TypeError: Bad argument at TypeError (native) at ChildProcess.spawn
The `server.start` method's `this` context is lost when bound directly in `gulp.watch`.
fix
Wrap the bound function in an anonymous function: `gulp.watch('myapp.js', function() { server.start.bind(server)() });`
ERR_REQUIRE_ESM
Attempting to `require()` this CommonJS-only package in an ES Module context (e.g., a file with `"type": "module"` in `package.json` or a `.mjs` extension).
fix
Ensure your `gulpfile.js` is a CommonJS file (plain `.js` without `"type": "module"` in `package.json` or a separate `cjs` folder for Gulp tasks) and use `const gls = require('gulp-live-server');`.
ReferenceError: gulp is not defined
The `gulp` object was not correctly imported or available in the scope where `gulp-live-server` is used.
fix
Ensure `var gulp = require('gulp');` is present at the top of your `gulpfile.js` and `gulp` is installed as a development dependency (`npm install --save-dev gulp`).
Upgrade
Version history
0.0.31latest on npm
Audit
Dependencies
gulprequiredThis is a Gulp plugin and requires Gulp to define tasks and orchestrate the server setup and watch operations.
Agent activity
8 hits · last 30 days
node
8
Resources
gulp-live-server — npm install gulp-live-server · libregistry