Alive Server
raw JSON → 1.3.0 verified Sat Apr 25 auth: no javascript
Alive Server is a fork of live-server, a simple development HTTP server with live reload capability for front-end development. The latest stable version is 1.3.1 (released January 2023). It supports middleware injection, custom mime types, SPA mode, and HTTPS. Key differentiators from live-server include active maintenance, merged PRs, and support for config file (.alive-server.json). It is designed for local development only, not production deployment.
Common errors
error Error: Cannot find module 'send' ↓
cause Missing dependency 'send' when using programmatic API without installing dependencies.
fix
Run 'npm install send' in your project or ensure alive-server is installed globally with all dependencies.
error TypeError: liveServer.start is not a function ↓
cause Trying to use ESM import (e.g., import liveServer from 'alive-server') which returns undefined.
fix
Use const liveServer = require('alive-server'); /* then liveServer.start(params) */
error alive-server: command not found ↓
cause alive-server is not installed globally or not in PATH.
fix
Run 'npm install -g alive-server' and ensure npm global bin directory is in PATH.
error port is already in use ↓
cause The specified port is occupied by another process.
fix
Use --port to specify a different port, or kill the process using the current port.
Warnings
gotcha The config file is named .alive-server.json, not .live-server.json (since v1.3.0). Using .live-server.json will be ignored. ↓
fix Rename .live-server.json to .alive-server.json
deprecated The --ignorePattern flag is deprecated in favor of --ignore (anymatch patterns). ↓
fix Use --ignore instead of --ignorePattern
breaking In v1.3.0, the ignore and watch fields in config file changed from string to array format. A single string will no longer be accepted. ↓
fix Ensure ignore and watch values in .alive-server.json are arrays (e.g., ["*.scss"])
deprecated The option --https-module is replaced by --https pointing to a config module; the old flag may be removed. ↓
fix Use --https=PATH to a JS file exporting an HTTPS configuration object
gotcha The package does not have a default export; requiring 'alive-server' returns an object with start and params. Using import will fail unless using a CommonJS interop. ↓
fix Use require('alive-server') instead of import
Install
npm install alive-server yarn add alive-server pnpm add alive-server Imports
- programmatic API wrong
const aliveServer = require('alive-server');correctimport { default as aliveServer } from 'alive-server'; - liveServer wrong
import { liveServer } from 'alive-server';correctconst liveServer = require('alive-server'); exports the start function - start wrong
import { start } from 'alive-server';correctconst { start } = require('alive-server'); - params wrong
import { params } from 'alive-server';correctconst params = require('alive-server').params;
Quickstart
// Install globally: npm install -g alive-server
// Then serve current directory:
// alive-server --port=3000 --open=/index.html --no-browser
// Programmatic usage (CommonJS):
const liveServer = require('alive-server');
const params = {
port: 9000,
host: '0.0.0.0',
root: process.cwd(),
open: false,
ignore: '*.scss',
file: 'index.html',
wait: 100,
mount: [['/components', './node_modules']],
logLevel: 2,
middleware: [function(req, res, next) {
next();
}]
};
liveServer.start(params);