npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

error-narrator

v2.0.1

Published

Voice notifications for development errors

Downloads

159

Readme

🔊 Error Narrator

Voice notifications for development errors - Never miss an error again!

Error Narrator automatically speaks out loud when JavaScript errors occur during development, so you don't have to constantly watch the console. It uses text-to-speech to narrate errors in a human-friendly way, helping you catch issues faster and maintain your development flow.

✨ Features

  • 🎯 Automatic Error Detection - Catches uncaught exceptions and unhandled promise rejections
  • 🧠 Smart Error Processing - Converts technical errors into human-readable messages
  • 🔄 Queue Management - Handles multiple errors without overwhelming you
  • ⏱️ Cooldown System - Prevents spam from repeated errors
  • 🎛️ Highly Configurable - Customize voice, rate, filters, and more
  • 🌐 Universal Support - Works in browsers, Node.js, React, and webpack
  • 📱 Framework Integrations - Built-in React components and webpack plugin

🚀 Quick Start

Installation

npm install error-narrator
# or
yarn add error-narrator
# or
pnpm add error-narrator

Quick Start

Browser (Vanilla JS)

import ErrorNarrator from "error-narrator";

// Quick setup with defaults
const narrator = new ErrorNarrator();

// Test it out
narrator.test("Error narrator is working!");

// Manual error handling
try {
  someRiskyCode();
} catch (error) {
  narrator.handleError(error);
}

React Integration

import React from "react";
import { ErrorNarratorProvider, useErrorNarrator } from "error-narrator";

function App() {
  return (
    <ErrorNarratorProvider options={{ enabled: true, rate: 1.1 }}>
      // inside your page use the useErrorNarrator(); hook to trigger errors
      <MyComponent />
    </ErrorNarratorProvider>
  );
}

function MyComponent() {
  const { handleError, test } = useErrorNarrator();

  const handleClick = () => {
    try {
      throw new Error("Demo error for testing");
    } catch (error) {
      handleError(error);
    }
  };

  return (
    <div>
      <button onClick={handleClick}>Trigger Error</button>
      <button onClick={() => test("React integration working!")}>
        Test Voice
      </button>
    </div>
  );
}

Configuration Options

const narrator = new ErrorNarrator({
  enabled: true, // Enable/disable voice notifications
  voice: null, // Voice name (browser) or system voice (Node.js)
  rate: 1, // Speech rate (0.1 - 10)
  pitch: 1, // Speech pitch (0 - 2, browser only)
  volume: 1, // Speech volume (0 - 1, browser only)
  maxMessageLength: 100, // Maximum message length
  cooldownMs: 5000, // Cooldown between similar errors
  humanize: true, // Convert technical errors to human language
  fallbackToRaw: true, // Use raw error if humanization fails
  debug: false, // Enable debug logging

  filters: {
    ignorePatterns: [
      // Patterns to ignore
      "ResizeObserver loop limit exceeded",
      "Loading chunk",
    ],
    onlyPatterns: null, // Only speak errors matching these patterns
    errorTypes: [
      // Error types to handle
      "SyntaxError",
      "ReferenceError",
      "TypeError",
      "RangeError",
      "Error",
    ],
  },
});

API Reference

Core Methods

import ErrorNarrator from "error-narrator";

// Create narrator instance
const narrator = new ErrorNarrator(options);

// Manual error handling
narrator.handleError(error);

// Speak custom message
narrator.speak("Custom message");

// Test the narrator
narrator.test("Test message");

// Control
narrator.enable();
narrator.disable();
narrator.clearQueue();

// Configuration
narrator.updateConfig({ rate: 1.5 });
narrator.getStatus();

React Hook API

import { useErrorNarrator } from "error-narrator";

const {
  narrator, // ErrorNarrator instance
  speak, // Speak custom message
  handleError, // Handle error manually
  enable, // Enable narrator
  disable, // Disable narrator
  test, // Test voice
  clearQueue, // Clear speech queue
  getStatus, // Get current status
  updateConfig, // Update configuration
} = useErrorNarrator();

Error Humanization

Error Narrator automatically converts technical errors into human-readable messages:

| Original Error | Spoken Message | | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | | Cannot read property 'name' of undefined | "Cannot read property name of undefined. Check if the object exists." | | fetch is not a function | "fetch is not a function. Check if it's properly imported or defined." | | Unexpected token '}' in JSON at position 45 | "JSON syntax error at position 45. Unexpected }." | | Module not found: ./nonexistent | "Module not found. Check your import path and make sure the package is installed." | | Objects are not valid as a React child | "React error: Cannot render an object directly. Use JSON.stringify or render object properties individually." |

Framework Integrations

React Error Boundary

import { ErrorNarratorProvider } from "error-narrator";

function App() {
  return (
    <ErrorNarratorProvider options={{ enabled: true }}>
      <ErrorBoundary>
        <MyApp />
      </ErrorBoundary>
    </ErrorNarratorProvider>
  );
}

Higher-Order Component

import { withErrorNarration } from "error-narrator";

const MyComponentWithNarration = withErrorNarration(MyComponent, {
  enabled: true,
  rate: 1.2,
});

Advanced Usage

Custom Error Processing

import { ErrorProcessor } from "error-narrator";

// Check if error should be ignored
if (ErrorProcessor.shouldIgnoreError(error)) {
  return;
}

// Get humanized error message
const humanMessage = ErrorProcessor.humanizeError(error, config);

// Get error severity
const severity = ErrorProcessor.getErrorSeverity(error);

Features

Browser

  • Uses Web Speech API
  • Supports voice selection from available system voices
  • Handles page visibility and focus states
  • Automatic cleanup on page unload

Voice Options

macOS: Alex, Samantha, Victoria, Daniel, Fiona, and many more Windows: Microsoft David, Microsoft Hazel, Microsoft Zira Linux: Default espeak voice

Examples

Development Server Integration

React Development

import { ErrorNarratorProvider } from "error-narrator";

export default function App({ Component, pageProps }) {
  return (
    <ErrorNarratorProvider
      options={{
        enabled: process.env.NODE_ENV === "development",
        rate: 1.1,
        maxMessageLength: 150,
      }}
    >
      <Component {...pageProps} />
    </ErrorNarratorProvider>
  );
}

Troubleshooting

Common Issues

No voice output in browser:

  • Check if Web Speech API is supported
  • Ensure page has user interaction (required by most browsers)
  • Check browser permissions for speech synthesis

Errors not being caught:

  • Check if autoSetup is enabled (default: true)
  • Verify error filters aren't too restrictive
  • Enable debug mode to see what's happening

Debug Mode

const narrator = new ErrorNarrator({
  debug: true, // Enable detailed logging
});

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - see LICENSE file for details.

Changelog

v2.0.1

  • Initial release
  • Browser support
  • React integration
  • Error humanization
  • Queue management
  • Cooldown system

🙋‍♂️ Support

Happy debugging! 🎉 Never miss an error again with Error Narrator.