Autocorrect Node Linux x64 Musl Binary

raw JSON →
2.14.0 verified Thu Apr 23 auth: no javascript

This package (`autocorrect-node-linux-x64-musl`) provides the precompiled native binary for `autocorrect-node` tailored for Linux systems using the musl libc library on x64 architecture. `autocorrect-node` is a native Node.js addon built on NAPI.RS, offering fast and efficient text autocorrection, particularly beneficial for copywriting, correcting spaces, words, and punctuation in CJK (Chinese, Japanese, Korean) languages. This specific package is an internal, platform-dependent runtime dependency of the main `autocorrect-node` library and is not intended for direct use by developers. The current stable version for this binary, mirroring its parent package, is 2.14.0. Its release cadence is tightly coupled with the `autocorrect-node` project, typically updating with major `autocorrect-node` releases or when new native build targets are introduced.

error Error: The `autocorrect` native module failed to load.
cause The main `autocorrect-node` package could not find or load a compatible native binary for your current environment. This often means the correct platform-specific binary (like `autocorrect-node-linux-x64-musl`) is missing or incompatible.
fix
Ensure autocorrect-node is installed, which should pull in the correct platform binary as an optionalDependency. If manually installing, make sure autocorrect-node-linux-x64-musl matches your OS and libc variant. Verify Node.js version compatibility.
error Error: Cannot find module 'autocorrect-node-linux-x64-musl'
cause Node.js failed to locate the installed native binary package. This could be due to incorrect installation, corrupted `node_modules`, or an environment mismatch where `autocorrect-node` expects this specific package but it's not available.
fix
Run npm install or yarn install in your project root to ensure all dependencies are correctly installed. Check package.json for autocorrect-node and ensure that npm or yarn successfully installed the correct optional dependencies for your platform.
breaking Major version upgrades of `autocorrect-node` may introduce breaking changes in the native module interface (NAPI), requiring a corresponding update to this binary package. Ensure `autocorrect-node` and its native binaries are kept in sync.
fix Always update `autocorrect-node` and its platform-specific dependencies (like `autocorrect-node-linux-x64-musl`) to their latest compatible versions together.
gotcha This package is specifically for `x86_64-unknown-linux-musl`. Installing it on an incompatible system (e.g., glibc-based Linux, macOS, Windows, or a different architecture) will lead to runtime errors when `autocorrect-node` attempts to load the native module.
fix Ensure that the correct platform-specific `autocorrect-node-*` package is installed for your environment. `autocorrect-node` typically handles this automatically via `optionalDependencies` or architecture detection; avoid direct installation of specific binary packages unless necessary for custom build environments.
gotcha Native Node.js modules can sometimes fail to load due to `node-abi` compatibility issues, mismatched Node.js versions, or specific system library versions (like `musl` vs `glibc`).
fix Check your Node.js version and ensure it is compatible with the `autocorrect-node` binaries. Verify that your system's `libc` (musl or glibc) matches the binary variant. Reinstalling `node_modules` might resolve transient issues.
npm install autocorrect-node-linux-x64-musl
yarn add autocorrect-node-linux-x64-musl
pnpm add autocorrect-node-linux-x64-musl

Demonstrates basic usage of `autocorrect-node`'s `autocorrect` function, showcasing how the underlying native binary (this package) is implicitly utilized for text correction. Also includes a conceptual CLI usage.

import { autocorrect } from 'autocorrect-node';

async function runAutocorrect() {
  const text = "你好Hello世界";
  // This implicitly uses the native binary for correction.
  const correctedText = await autocorrect(text);
  console.log(`Original: ${text}`);
  console.log(`Corrected: ${correctedText}`);

  // Example of using the CLI via programmatic execution (for illustration)
  // In a real app, you'd typically run this directly from the shell or rely on build tools.
  try {
    const { exec } = await import('node:child_process');
    exec(`echo "${text}" | yarn autocorrect --stdin`, (error, stdout, stderr) => {
      if (error) {
        console.error(`CLI exec error: ${error.message}`);
        return;
      }
      if (stderr) {
        console.error(`CLI stderr: ${stderr}`);
        return;
      }
      console.log(`CLI Corrected: ${stdout.trim()}`);
    });
  } catch (e) {
    console.warn("Cannot run CLI example without 'node:child_process' or yarn/npm in path.", e);
  }
}

runAutocorrect().catch(console.error);