{"id":10989,"library":"gulp-live-server","title":"Gulp Live Server","description":"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.","status":"abandoned","version":"0.0.31","language":"javascript","source_language":"en","source_url":"git://github.com/gimm/gulp-live-server","tags":["javascript","gulpplugin","server","static","live","livereload","connect","express"],"install":[{"cmd":"npm install gulp-live-server","lang":"bash","label":"npm"},{"cmd":"yarn add gulp-live-server","lang":"bash","label":"yarn"},{"cmd":"pnpm add gulp-live-server","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"This is a Gulp plugin and requires Gulp to define tasks and orchestrate the server setup and watch operations.","package":"gulp","optional":false}],"imports":[{"note":"The package is CommonJS-only. Use `require()` for the main plugin instance.","wrong":"import gls from 'gulp-live-server';","symbol":"gls","correct":"const gls = require('gulp-live-server');"},{"note":"This method creates a server for serving static files. The package does not support ES Module named imports.","wrong":"import { static } from 'gulp-live-server';","symbol":"gls.static","correct":"const server = gls.static('public');"},{"note":"This method starts a server by running a custom Node.js script. The package does not support ES Module named imports.","wrong":"import { new } from 'gulp-live-server';","symbol":"gls.new","correct":"const server = gls.new('myapp.js');"}],"quickstart":{"code":"const gulp = require('gulp');\nconst gls = require('gulp-live-server');\n\ngulp.task('serve-static', function() {\n  // 1. Serve with default settings (serves 'public' folder on port 3000)\n  const server = gls.static();\n  server.start();\n\n  // 2. Serve at a custom port for 'dist' folder\n  const customPortServer = gls.static('dist', 8888);\n  customPortServer.start();\n\n  // 3. Serve multiple folders\n  const multiFolderServer = gls.static(['dist', '.tmp']);\n  multiFolderServer.start();\n\n  // Use gulp.watch to trigger server actions (notify, start or stop)\n  gulp.watch(['static/**/*.css', 'static/**/*.html'], function (file) {\n    server.notify.apply(server, [file]);\n    customPortServer.notify.apply(customPortServer, [file]);\n    multiFolderServer.notify.apply(multiFolderServer, [file]);\n  });\n});\n\n// To run: `gulp serve-static`","lang":"javascript","description":"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."},"warnings":[{"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.","message":"This 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.","severity":"breaking","affected_versions":">=0.0.31"},{"fix":"Wrap `server.start.bind(server)` in an anonymous function to ensure correct context: `gulp.watch('myapp.js', function() { server.start.bind(server)() });`.","message":"When 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.","severity":"gotcha","affected_versions":">=0.0.31"},{"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.","message":"This 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.","severity":"gotcha","affected_versions":">=0.0.31"}],"env_vars":null,"search_vec":"'0.0.31':108 '2017':116 '7':112 'abstract':32 'allow':56 'applic':30 'asset':27 'automat':68 'awar':120 'back':110 'browser':67,92 'capabl':24 'chang':72 'compat':123 'complex':34 'connect':43,144 'custom':83 'date':109 'design':13 'despit':95 'develop':17,57 'es':136 'especi':133 'express':45,145 'file':71,80 'gulp':1,5,11,131 'gulp-live-serv':4 'gulpplugin':139 'integr':20 'intern':46 'issu':124 'javascript':138 'juli':115 'larg':101 'last':105 'lightweight':10 'live':2,6,22,142 'live-reload':21 'livereload':50,143 'lr':55 'method':76 'modern':130 'modul':137 'newer':126 'node.js':29,84,127 'notifi':90 'offer':75 'packag':74,99 'plugin':12 'potenti':41,122 'provid':15 'quick':59 'refresh':69 'releas':106 'reload':23 'run':81 'script':85 'separ':49 'serv':78 'server':3,7,18,40,51,63,88,140 'set':36 'setup':132 'spin':60 'static':26,79,141 'tini':54 'tiny-lr':53 'unmaintain':102 'updat':94 'upon':70 'use':42,135 'user':117 'util':97 'version':107,128 'via':52 'web':39 'year':113","created_at":"2026-04-19T13:35:40.382027+00:00","updated_at":"2026-04-19T13:35:40.382027+00:00","problems":[{"fix":"Wrap the bound function in an anonymous function: `gulp.watch('myapp.js', function() { server.start.bind(server)() });`","cause":"The `server.start` method's `this` context is lost when bound directly in `gulp.watch`.","error":"TypeError: Bad argument at TypeError (native) at ChildProcess.spawn"},{"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');`.","cause":"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).","error":"ERR_REQUIRE_ESM"},{"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`).","cause":"The `gulp` object was not correctly imported or available in the scope where `gulp-live-server` is used.","error":"ReferenceError: gulp is not defined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/gimm/gulp-live-server","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/gulp-live-server","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","web-framework","http-networking"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-18","install_tag":null}}