tursodatabase/turso · error · Error

Native binding package version mismatch, expected 0.8.0-pre.

Error message

Native binding package version mismatch, expected 0.8.0-pre.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.

What it means

The napi-rs generated loader for @tursodatabase/sync-native verifies that the platform-specific native package (@tursodatabase/sync-openharmony-arm64 here) has exactly the same version as the JavaScript wrapper (0.8.0-pre.3). When NAPI_RS_ENFORCE_VERSION_CHECK is set to a value other than '0', a mismatch aborts loading of that binding. This protects against subtle ABI breakage when a stale optional dependency ships an older or newer .node binary than the JS API expects.

Source

Thrown at bindings/javascript/sync/packages/native/index.js:432

        return binding
      } catch (e) {
        loadErrors.push(e)
      }
    } else {
      loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
    }
  } else if (process.platform === 'openharmony') {
    if (process.arch === 'arm64') {
      try {
        return require('./sync.openharmony-arm64.node')
      } catch (e) {
        loadErrors.push(e)
      }
      try {
        const binding = require('@tursodatabase/sync-openharmony-arm64')
        const bindingPackageVersion = require('@tursodatabase/sync-openharmony-arm64/package.json').version
        if (bindingPackageVersion !== '0.8.0-pre.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
          throw new Error(`Native binding package version mismatch, expected 0.8.0-pre.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
        }
        return binding
      } catch (e) {
        loadErrors.push(e)
      }
    } else if (process.arch === 'x64') {
      try {
        return require('./sync.openharmony-x64.node')
      } catch (e) {
        loadErrors.push(e)
      }
      try {
        const binding = require('@tursodatabase/sync-openharmony-x64')
        const bindingPackageVersion = require('@tursodatabase/sync-openharmony-x64/package.json').version
        if (bindingPackageVersion !== '0.8.0-pre.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
          throw new Error(`Native binding package version mismatch, expected 0.8.0-pre.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
        }
        return binding

View on GitHub (pinned to 244cde92a7)

Solutions

  1. Remove node_modules and package-lock.json, then run 'npm i' so the optional dependency resolves to the matching 0.8.0-pre.3 release
  2. Explicitly install the matching platform package: npm i @tursodatabase/sync-openharmony-arm64@0.8.0-pre.3
  3. As a temporary escape hatch, set NAPI_RS_ENFORCE_VERSION_CHECK=0 to skip the strict check (only if you know the ABI is compatible)
  4. If you vendored the .node file, ensure ./sync.openharmony-arm64.node is present so the loader never falls back to the npm package

Example fix

# before
npm i @tursodatabase/sync-native@0.8.0-pre.3
# installs @tursodatabase/sync-openharmony-arm64@0.8.0-pre.2 from a stale lockfile -> throws

# after
rm -rf node_modules package-lock.json
npm i @tursodatabase/sync-native@0.8.0-pre.3
# or pin explicitly:
npm i @tursodatabase/sync-openharmony-arm64@0.8.0-pre.3
Defensive patterns

Strategy: validation

Validate before calling

// before import, verify the platform package matches the wrapper version
const pkg = require('@tursodatabase/sync-native/package.json');
const plat = require('@tursodatabase/sync-openharmony-arm64/package.json');
if (pkg.version !== plat.version) {
  throw new Error(`Version skew: wrapper ${pkg.version} vs native ${plat.version} - run npm i`);
}

Try / catch

try {
  const { Database } = await import('@tursodatabase/sync-native');
} catch (e) {
  for (const cause of e.cause ?? []) console.error('binding load failure:', cause?.message);
  console.error('Fix: rm -rf node_modules package-lock.json && npm i');
  process.exit(1);
}

Prevention

When it happens

Trigger: Running on OpenHarmony with process.arch === 'arm64', where the local ./sync.openharmony-arm64.node require failed, so the loader falls back to the npm package @tursodatabase/sync-openharmony-arm64 whose package.json version differs from 0.8.0-pre.3, while the environment variable NAPI_RS_ENFORCE_VERSION_CHECK is set and not '0'.

Common situations: A half-updated install where package-lock.json pinned the optional dependency to an older release; CI environments that set NAPI_RS_ENFORCE_VERSION_CHECK=1 globally; mixed versions after 'npm update @tursodatabase/sync-native' without updating platform packages; caching proxies (Artifactory/Nexus) serving a stale platform package.

Related errors


AI-assisted analysis of tursodatabase/turso@244cde92a7 (2026-08-20). Data as JSON: /api/errors/42c63a41ee53eea9. Report an issue: GitHub.