Registry / web-framework / grunt-http-server

grunt-http-server

JSON →
library2.1.0jsnpmunverified

grunt-http-server is a Grunt task designed to serve static files from within a Grunt build process. It allows developers to quickly set up a local HTTP or HTTPS server for development and testing purposes. The package, currently at version 2.1.0 (last published in 2015), offers features such as serving files from a specified root directory, configurable ports and hosts, caching, directory listing, automatic index file serving, custom file extensions, and a proxying capability for requests not resolved locally. It also supports HTTPS with custom certificates and allows opening a browser automatically. Its primary differentiation lies in its integration with the Grunt ecosystem, providing a task-based approach to running a simple web server, unlike modern standalone CLI tools or bundler-specific development servers. The project has not seen updates since 2016, indicating it is no longer actively maintained.

npm install grunt-http-server
INSTALL
IMPORT
SIG · GRUNT-HTTP-SERVER
G
grunt-http-server
web-frameworkjavascriptv2.1.0
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.

grunt-http-server
grunt.loadNpmTasks('grunt-http-server');
import { 'http-server' } from 'grunt-http-server'; // OR const http_server = require('grunt-http-server');
This package is a Grunt plugin that registers the `http-server` multi-task. It is not directly imported as a JavaScript module but loaded via Grunt's plugin system within your Gruntfile.js.
http-server task configuration
grunt.initConfig({ 'http-server': { 'dev': { root: 'dist', port: 8080 } } });
The `http-server` task is configured as a multi-task within your Gruntfile's `initConfig` object after being loaded with `loadNpmTasks`.

This quickstart demonstrates how to configure and run a basic static HTTP server using `grunt-http-server` within a Gruntfile, serving files from a 'dist' directory, enabling HTTPS, and opening a browser automatically.

module.exports = function(grunt) { grunt.initConfig({ 'http-server': { 'dev': { // the server root directory root: 'dist', // Assume 'dist' is your build output folder // the server port port: 8282, // the host ip address host: '0.0.0.0', cache: 0, // No caching for dev showDir: true, autoIndex: true, ext: 'html', runInBackground: false, logFn: function(req, res, error) {}, // proxy: 'http://someurl.com', https: { cert: 'path/to/cert.pem', // Replace with your actual cert path key : 'path/to/key.pem' // Replace with your actual key path }, openBrowser : true, customPages: { '/readme': 'README.md' } } } }); // Load the plugin that provides the 'http-server' task. grunt.loadNpmTasks('grunt-http-server'); // Default task. grunt.registerTask('default', ['http-server:dev']); };
Debug
Known issues
gotchaThe `grunt-http-server` package is abandoned and no longer maintained. Its last update was in 2016. Using it may introduce compatibility issues with modern Node.js versions and lacks ongoing security patches. It is not recommended for new projects or production environments.
fix
Consider migrating to actively maintained static server solutions like `http-server` (CLI), `serve`, `browsersync`, `webpack-dev-server`, or `vite` for better compatibility, features, and security.
affects: >=2.1.0
gotchaThis package was developed for older Node.js versions (>=0.8.0). It may exhibit unexpected behavior, throw errors, or fail to run entirely on modern Node.js runtimes (e.g., Node.js 16+ or 18+).
fix
Thoroughly test on your target Node.js version. If issues arise, migration to a more current static server solution is highly recommended.
affects: >=2.1.0
gotchaAs an unmaintained package, `grunt-http-server` has not received security updates since 2016. It may contain unpatched vulnerabilities, particularly concerning path traversal, directory listing exploits, or other common web server security flaws. Avoid using it in production environments or with untrusted content.
fix
Migrate to actively maintained static server solutions with a strong security track record to mitigate potential vulnerabilities.
affects: >=2.1.0
Errors
Common errors & fixes
Warning: Task "http-server:dev" not found.
The Grunt task was not loaded correctly, or the task name in `registerTask` does not match the configured task.
fix
Ensure `grunt.loadNpmTasks('grunt-http-server');` is present in your Gruntfile.js and that the task name used in `grunt.registerTask` (e.g., 'http-server:dev') matches your configuration.
Error: listen EADDRINUSE: address already in use :::8080
The specified `port` (e.g., 8080) in the `http-server` configuration is already in use by another application or process on your system.
fix
Change the `port` option in your `http-server` configuration to an available port number (e.g., 8000, 9000), or identify and terminate the process currently using that port.
Server started at http://0.0.0.0:8282, but files are not loading or return 404.
The `root` path specified in the `http-server` configuration does not correctly point to the directory containing your static files.
fix
Verify that the `root` option in your `http-server` configuration specifies the correct absolute or relative path to your static asset directory, relative to your Gruntfile.js.
Upgrade
Version history
2.1.0latest on npm
Audit
Dependencies
gruntrequiredRequired peer dependency for this Grunt task to function.
Agent activity
13 hits · last 30 days
node
13
Resources
grunt-http-server — npm install grunt-http-server · libregistry