Registry / web-framework / five-server

five-server

JSON →
library0.4.5jsnpmunverified

Five Server is a modern development server with live reload capabilities, designed as a maintained fork of the popular `live-server` package. It is completely rewritten in TypeScript and aims to provide up-to-date dependencies and enhanced features compared to its predecessor. Currently at version 0.4.5, it offers features like remote logs for debugging on mobile devices, built-in PHP server support, and compatibility with Server Side Rendered applications (e.g., Express.js). While it ships with a CLI, it also offers a programmatic API for integration into projects. Key differentiators include its robust module import options for various JavaScript environments and features specifically for its VSCode extension, and it targets Node.js version 16 or higher.

npm install five-server
INSTALL
IMPORT
SIG · FIVE-SERVER
F
five-server
web-frameworkjavascriptv0.4.5
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.

FiveServer
import FiveServer from 'five-server'
const FiveServer = require('five-server')
Default ESM import for TypeScript projects or modern browser environments.
FiveServer
import FiveServer from 'five-server/esm.mjs'
import FiveServer from 'five-server'
Explicit ESM import path for Node.js module environments to ensure correct resolution without relying on package.json 'exports'.
FiveServer
const FiveServer = require('five-server').default
const FiveServer = require('five-server')
CommonJS import requires `.default` due to ESM interoperability and how the package is bundled.

Demonstrates how to programmatically start Five Server, serving a specific directory on a custom port with live reload, without automatically opening a browser. Includes setup for a test 'public' folder.

import FiveServer from 'five-server'; import path from 'path'; import fs from 'fs'; // Create a dummy 'public' directory and an index.html file for demonstration const publicDir = path.join(process.cwd(), 'public'); if (!fs.existsSync(publicDir)) { fs.mkdirSync(publicDir, { recursive: true }); } fs.writeFileSync(path.join(publicDir, 'index.html'), '<h1>Hello Five Server!</h1><p>Watch me reload.</p>', 'utf8'); // Example: Serve the 'public' directory on port 8080 without opening a browser automatically. const server = new FiveServer(); server.start({ port: 8080, root: publicDir, // Set the document root to the 'public' directory open: false, // Do not open browser automatically watch: true, // Enable live reload dir: publicDir // Ensure 'dir' is also set for correct root behavior }).then(() => { console.log('Five Server started on http://localhost:8080'); console.log(`Watching for changes in: ${publicDir}`); console.log('Open your browser to http://localhost:8080'); }).catch(err => { console.error('Failed to start Five Server:', err); });
five-server --version
Debug
Known issues
breakingFive Server is a complete rewrite and maintained fork of `live-server`. Migrating from `live-server` requires uninstalling the old package (`npm -g rm live-server`) and installing `five-server`. The API for programmatic usage has changed significantly.
fix
Uninstall `live-server` globally and install `five-server`. Review the new API for programmatic usage and configuration options.
affects: >=0.1.0
gotchaAdvanced features like 'Instant Updates', 'Highlights', and 'Auto Navigation' are exclusively available through the Five Server VSCode Extension, not via the standalone CLI or programmatic API.
fix
Install the Five Server VSCode Extension (`yandeu.five-server`) to utilize these editor-integrated functionalities.
affects: >=0.1.0
breakingFive Server requires Node.js version 16 or higher. Older Node.js versions are not supported, and attempting to run it on unsupported versions will result in errors.
fix
Upgrade your Node.js environment to version 16 or newer using a version manager like `nvm` or `fnm`.
affects: >=0.1.0
gotchaDue to varied module resolver behaviors across JavaScript environments, explicit import paths or `.default` access might be required for programmatic usage in Node.js ESM or CommonJS. Simply importing from 'five-server' might not always work directly.
fix
For Node.js ESM, use `import FiveServer from 'five-server/esm.mjs'`. For CommonJS, use `const FiveServer = require('five-server').default`.
affects: >=0.1.0
Errors
Common errors & fixes
TypeError: FiveServer is not a constructor
Attempting to instantiate `FiveServer` in CommonJS by directly requiring the package without accessing its default export (e.g., `require('five-server')`).
fix
Correct the import to `const FiveServer = require('five-server').default;`
SyntaxError: Named export 'FiveServer' not found. The requested module 'five-server' does not provide an export named 'FiveServer'
Incorrectly using a named import for a default export, or attempting `import FiveServer from 'five-server'` in a Node.js ESM environment where the direct root import might not resolve correctly.
fix
Use the explicit ESM path: `import FiveServer from 'five-server/esm.mjs';` or fall back to: `import pkg from 'five-server'; const { default: FiveServer } = pkg;`
Error: listen EADDRINUSE: address already in use :::8080
Another process on your system is already using the port that Five Server is trying to bind to (e.g., port 8080).
fix
Change the port number in your configuration (e.g., `five-server --port 8081` in CLI, or `{ port: 8081 }` in your programmatic options) or identify and terminate the conflicting process.
Upgrade
Version history
0.4.5latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
five-server — npm install five-server · libregistry