Envinfo is a comprehensive command-line tool and Node.js library that automatically collects development environment information needed for debugging and troubleshooting software issues. It systematically gathers details about the operating system, binary versions, browsers, installed programming languages, package managers, development tools, and runtime environments in a structured format.
npm install -g envinfo (CLI) or npm install envinfo (library)const envinfo = require('envinfo');
// Or destructure specific functions
const { run, cli, main, helpers } = require('envinfo');
// Access formatters and presets
const { formatters } = require('envinfo');
const { helpers: { getNodeInfo, getOSInfo } } = require('envinfo');
// Import packages module functions directly
const { getnpmPackages, getnpmGlobalPackages } = require('envinfo').helpers;For ES modules:
import envinfo from 'envinfo';
// Or destructure specific functions
import { run, cli, main, helpers } from 'envinfo';
// Access sub-modules
import { formatters, presets } from 'envinfo';# Get default environment information
envinfo
# Get specific categories
envinfo --system --browsers --languages
# Get all information
envinfo --all
# Output as JSON
envinfo --json
# Output as Markdown
envinfo --markdownconst envinfo = require('envinfo');
// Basic usage with default settings
envinfo.run().then(result => {
console.log(result);
});
// Specific information categories
envinfo.run({
System: ['OS', 'CPU', 'Memory'],
Binaries: ['Node', 'npm', 'Yarn'],
Browsers: ['Chrome', 'Firefox']
}, {
json: true
}).then(result => {
console.log(result);
});
// Using presets
envinfo.run({ preset: 'react-native' }).then(result => {
console.log(result);
});Envinfo is built around several key components:
run, main, cli) that orchestrate data collectionPrimary API functions for collecting and formatting environment information programmatically.
/**
* Main programmatic interface for collecting environment information
* @param args - Configuration object or preset name
* @param options - Collection and formatting options
* @returns Promise<string> - Formatted environment information
*/
function run(args, options);
/**
* Core function that orchestrates environment data collection
* @param props - Configuration specifying which information to collect
* @param options - Formatting and collection options
* @returns Promise<string> - Formatted environment report
*/
function main(props, options);
/**
* CLI interface handler for processing command-line options
* @param options - Parsed command-line options
* @returns Promise<string> - Formatted environment report
*/
function cli(options);Comprehensive system for detecting and reporting environment details across multiple categories.
// System information
helpers.getOSInfo(); // Returns: Promise<[string, string]>
helpers.getCPUInfo(); // Returns: Promise<[string, string]>
helpers.getMemoryInfo(); // Returns: Promise<[string, string]>
helpers.getContainerInfo(); // Returns: Promise<[string, string]>
helpers.getShellInfo(); // Returns: Promise<[string, string, string]>
// Binary versions
helpers.getNodeInfo(); // Returns: Promise<[string, string, string]>
helpers.getnpmInfo(); // Returns: Promise<[string, string, string]>
helpers.getYarnInfo(); // Returns: Promise<[string, string, string]>
helpers.getpnpmInfo(); // Returns: Promise<[string, string, string]>
helpers.getbunInfo(); // Returns: Promise<[string, string, string]>
helpers.getWatchmanInfo(); // Returns: Promise<[string, string, string]>
// Package managers
helpers.getAptInfo(); // Returns: Promise<[string, string, string]>
helpers.getCargoInfo(); // Returns: Promise<[string, string, string]>
helpers.getHomebrewInfo(); // Returns: Promise<[string, string, string]>
helpers.getMavenInfo(); // Returns: Promise<[string, string, string]>
helpers.getComposerInfo(); // Returns: Promise<[string, string, string]>
// Development utilities
helpers.getGitInfo(); // Returns: Promise<[string, string, string]>
helpers.getGCCInfo(); // Returns: Promise<[string, string]>
helpers.getClangInfo(); // Returns: Promise<[string, string, string]>
helpers.getMakeInfo(); // Returns: Promise<[string, string]>
// Browsers
helpers.getChromeInfo(); // Returns: Promise<[string, string, string]>
helpers.getFirefoxInfo(); // Returns: Promise<[string, string, string]>
helpers.getSafariInfo(); // Returns: Promise<[string, string, string]>
helpers.getEdgeInfo(); // Returns: Promise<[string, string|string[], string]>
// Programming languages
helpers.getJavaInfo(); // Returns: Promise<[string, string, string]>
helpers.getPythonInfo(); // Returns: Promise<[string, string, string]>
helpers.getPython3Info(); // Returns: Promise<[string, string, string]>
helpers.getGoInfo(); // Returns: Promise<[string, string, string]>
helpers.getRustInfo(); // Returns: Promise<[string, string, string]>
// IDEs and editors
helpers.getVSCodeInfo(); // Returns: Promise<[string, string, string]>
helpers.getXcodeInfo(); // Returns: Promise<[string, string, string]>
helpers.getAtomInfo(); // Returns: Promise<[string, string, string]>
helpers.getVimInfo(); // Returns: Promise<[string, string]>
// Databases
helpers.getMongoDBInfo(); // Returns: Promise<[string, string, string]>
helpers.getMySQLInfo(); // Returns: Promise<[string, string, string]>
helpers.getPostgreSQLInfo(); // Returns: Promise<[string, string, string]>
helpers.getSQLiteInfo(); // Returns: Promise<[string, string, string]>
// SDKs (return complex objects)
helpers.getAndroidSDKInfo(); // Returns: Promise<[string, Object|string]>
helpers.getiOSSDKInfo(); // Returns: Promise<[string, Object|string]>
helpers.getWindowsSDKInfo(); // Returns: Promise<[string, Object|string]>
// Virtualization
helpers.getDockerInfo(); // Returns: Promise<[string, string, string]>
helpers.getVirtualBoxInfo(); // Returns: Promise<[string, string, string]>NPM package analysis including local dependencies, global packages, and version detection.
/**
* Gets local npm package versions and dependency information
* @param packages - Package names, glob pattern, or boolean for all packages
* @param options - Collection options including duplicates and fullTree
* @returns Promise<[string, Object]> - Package information object
*/
function getnpmPackages(packages, options);
/**
* Gets globally installed npm package versions
* @param packages - Package names, glob pattern, or boolean for all packages
* @param options - Collection options
* @returns Promise<[string, Object]> - Global package information object
*/
function getnpmGlobalPackages(packages, options);Multiple output formats with customizable options for different use cases.
/**
* Format data as JSON with optional indentation
* @param data - Environment data object
* @param options - Formatting options
* @returns string - JSON formatted output
*/
formatters.json(data, options);
/**
* Format data as YAML (default format)
* @param data - Environment data object
* @param options - Formatting options including console styling
* @returns string - YAML formatted output
*/
formatters.yaml(data, options);
/**
* Format data as Markdown
* @param data - Environment data object
* @param options - Formatting options
* @returns string - Markdown formatted output
*/
formatters.markdown(data, options);Pre-configured templates for common development environments and frameworks.
// Available presets
presets.defaults; // Object - Default environment collection
presets['react-native']; // Object - React Native development preset
presets.jest; // Object - Jest testing framework preset
presets.webpack; // Object - Webpack build tool preset
presets['create-react-app']; // Object - Create React App preset// Configuration object for specifying what information to collect
interface EnvironmentConfig {
System?: string[]; // ['OS', 'CPU', 'Memory', 'Container', 'Shell']
Binaries?: string[]; // ['Node', 'npm', 'Yarn', 'pnpm', 'bun', 'Watchman']
Browsers?: string[]; // Browser names to detect
Languages?: string[]; // Programming languages to detect
Managers?: string[]; // Package managers to detect
IDEs?: string[]; // IDEs and editors to detect
npmPackages?: string | string[] | boolean; // NPM packages to analyze
npmGlobalPackages?: string | string[] | boolean; // Global packages
// ... other categories
}
// Options for controlling collection and formatting
interface CollectionOptions {
json?: boolean; // Output as JSON
markdown?: boolean; // Output as Markdown
console?: boolean; // Enable console output
duplicates?: boolean; // Show duplicate package versions
fullTree?: boolean; // Traverse full dependency tree
showNotFound?: boolean; // Include "Not Found" results
title?: string; // Add title to report
}
// Helper function return format
type HelperResult = [string, string] | [string, string, string] | [string, 'Not Found'] | [string, 'N/A'];