RealFaviconGenerator CLI

raw JSON →
0.0.9 verified Thu Apr 23 auth: no javascript abandoned

cli-real-favicon is a Node.js command-line interface (CLI) tool designed to automate the process of generating multi-platform favicons using the RealFaviconGenerator web service. It allows developers to generate comprehensive icon sets (including web app manifests, iOS, Android, and Windows tile icons) based on a single source image and a detailed configuration file. The current stable version, 0.0.9, was released several years ago and the project appears to be unmaintained. This means it may not support the latest icon formats, browser requirements, or security best practices, and relies on an older version of the RealFaviconGenerator API. Its primary utility lies in programmatically generating favicon assets, but its age necessitates careful consideration for new projects. The tool's distinct feature is its ability to take a configuration exported from the RealFaviconGenerator website and apply it locally through a CLI.

error Error: Command failed with exit code 1
cause A generic error indicating a failure during the favicon generation process. This often stems from issues with the source image, network connectivity to RealFaviconGenerator.net, or problems writing to the output directory.
fix
Check the CLI output for any preceding warnings. Ensure the source image is valid and accessible. Verify network connectivity. Confirm the output directory exists and has write permissions. Review the favicon-config.json for any errors.
error cli-real-favicon: command not found
cause The `cli-real-favicon` executable is not available in your system's PATH. This typically happens if the package was not installed globally or if the global `node_modules` bin directory isn't in your PATH.
fix
If you intend to use it globally, run npm install -g cli-real-favicon. If installed locally in a project, execute it using npx cli-real-favicon or by referencing the binary directly: node_modules/.bin/cli-real-favicon.
error Error: ENONT: no such file or directory, open 'favicon-config.json'
cause The CLI cannot find the specified configuration file at the provided path. This indicates a file path error.
fix
Ensure the favicon-config.json file is present in the directory from which you are running the command, or provide the correct relative or absolute path to its location.
breaking The package (v0.0.9) has not been updated since 2017. It may rely on outdated dependencies with known security vulnerabilities (CVEs) and might not function correctly with modern Node.js versions (e.g., Node.js 16+ or ESM-only environments) or current RealFaviconGenerator API changes.
fix For new projects, consider actively maintained alternatives or use the RealFaviconGenerator website directly. If using this CLI, run in a controlled environment and audit dependencies for security risks. Modern Node.js versions might require polyfills or specific execution flags for older CJS modules.
gotcha The CLI's core functionality is entirely dependent on the external RealFaviconGenerator.net API. Any breaking changes, deprecations, or outages on the web service's side will directly impact the CLI's ability to generate favicons, without any possibility of a fix from this unmaintained package.
fix Always test the output thoroughly after generation. If generation fails or outputs are incorrect, first check the RealFaviconGenerator website for service status or API change announcements.
gotcha The configuration JSON, source image path, and output destination path are critical. Incorrect paths or an invalid configuration JSON (e.g., missing required fields) will lead to generation failures without clear error messages from the CLI.
fix Ensure `favicon-config.json` is a valid JSON. Verify that `src/logo.png` (or your chosen source image) exists and is accessible. Confirm that `public/favicons` (or your chosen output directory) is created and writable before running the command.
npm install cli-real-favicon
yarn add cli-real-favicon
pnpm add cli-real-favicon

This quickstart guides you through generating a comprehensive set of favicons using `cli-real-favicon`, leveraging a configuration obtained from the RealFaviconGenerator website.

// 1. Create a source image, e.g., `src/logo.png` (min. 260x260px).
// 2. Go to RealFaviconGenerator.net, upload your image, and customize your favicons.
// 3. On the result page, navigate to the 'Node CLI' tab and copy the generated configuration JSON.
//    Save this JSON to a file in your project, e.g., `favicon-config.json`.
//    (Example content below, your actual content will vary based on your choices):
{
  "design": {
    "ios": {
      "pictureAspect": "backgroundAndMargin",
      "backgroundColor": "#ffffff",
      "margin": "14%"
    },
    "androidChrome": {
      "pictureAspect": "noBackground",
      "themeColor": "#ffffff"
    },
    "safariPinnedTab": {
      "pictureAspect": "silhouette",
      "themeColor": "#5bbad5"
    },
    "windows": {
      "pictureAspect": "noBackground",
      "backgroundColor": "#da532c"
    }
  },
  "settings": {
    "compression": "false",
    "scalingAlgorithm": "Lanczos",
    "errorOnImageTooSmall": false,
    "readmeFile": false,
    "htmlCodeFile": false,
    "previewFile": false,
    "markupFile": false,
    "versioning": "false",
    "manifest": {
      "name": "My Awesome App",
      "display": "standalone",
      "orientation": "any",
      "startUrl": "/",
      "backgroundColor": "#ffffff",
      "themeColor": "#ffffff"
    }
  },
  "version": "0.16"
}

// 4. Install the CLI tool globally:
npm install -g cli-real-favicon

// 5. Run the favicon generation command. 
//    The paths for config, source image, and output directory are crucial.
mkdir -p public/favicons
cli-real-favicon generate favicon-config.json src/logo.png public/favicons

console.log('Favicons generated in public/favicons!');
// You will then integrate the generated HTML markup into your project's <head>.