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.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue. What it means
The napi-rs generated loader for @tursodatabase/sync requires the platform-specific native package (here @tursodatabase/sync-android-arm64) to have exactly the same version as the JS wrapper (0.8.0-pre.10). When requireNative loads the android-arm64 binding and its package.json version differs, and NAPI_RS_ENFORCE_VERSION_CHECK is set to anything other than '0', it throws this Error. It exists to prevent ABI mismatches between the JS API and the compiled .node binary.
Source
Thrown at bindings/javascript/sync/packages/native/index.js:85
function requireNative() {
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
try {
nativeBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
} catch (err) {
loadErrors.push(err)
}
} else if (process.platform === 'android') {
if (process.arch === 'arm64') {
try {
return require('./sync.android-arm64.node')
} catch (e) {
loadErrors.push(e)
}
try {
const binding = require('@tursodatabase/sync-android-arm64')
const bindingPackageVersion = require('@tursodatabase/sync-android-arm64/package.json').version
if (bindingPackageVersion !== '0.8.0-pre.10' && 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.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
}
return binding
} catch (e) {
loadErrors.push(e)
}
} else if (process.arch === 'arm') {
try {
return require('./sync.android-arm-eabi.node')
} catch (e) {
loadErrors.push(e)
}
try {
const binding = require('@tursodatabase/sync-android-arm-eabi')
const bindingPackageVersion = require('@tursodatabase/sync-android-arm-eabi/package.json').version
if (bindingPackageVersion !== '0.8.0-pre.10' && 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.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
}
return bindingView on GitHub (pinned to 492c4a71cd)
Solutions
- Run 'npm install' (or yarn/pnpm install) after deleting node_modules and the lockfile entry so all @tursodatabase/sync-* platform packages reinstall at matching versions
- Check that every installed @tursodatabase/sync-<platform> package reports version 0.8.0-pre.10 (npm ls @tursodatabase/sync-android-arm64)
- If you knowingly want to skip the check, set NAPI_RS_ENFORCE_VERSION_CHECK=0 in the environment
- Upgrade or downgrade the main @tursodatabase/sync package so its version matches the installed platform packages
Example fix
// before (mismatched package.json override)
"overrides": { "@tursodatabase/sync-android-arm64": "0.7.0" }
// after
"overrides": { "@tursodatabase/sync-android-arm64": "0.8.0-pre.10" } Defensive patterns
Strategy: validation
Validate before calling
const platformPkg = require('@tursodatabase/sync-android-arm64/package.json');
if (platformPkg.version !== require('@tursodatabase/sync/package.json').version) {
throw new Error(`Reinstall dependencies: binding version ${platformPkg.version} != wrapper version`);
} Try / catch
try {
const db = require('@tursodatabase/sync');
} catch (e) {
if (e.message.includes('version mismatch')) {
console.error('Run: rm -rf node_modules && npm install');
}
throw e;
} Prevention
- Always run a fresh install after bumping @tursodatabase/sync versions
- Commit lockfiles so every machine/CI resolves identical platform package versions
- Avoid package.json overrides/resolutions on @tursodatabase/sync-* platform packages
- Verify with 'npm ls @tursodatabase/sync-android-arm64' in CI that versions align
When it happens
Trigger: Calling requireNative() on an Android arm64 device/emulator when require('@tursodatabase/sync-android-arm64') succeeds but its package.json version is not '0.8.0-pre.10' and NAPI_RS_ENFORCE_VERSION_CHECK is set (and not '0').
Common situations: Mixed lockfile states where some @tursodatabase/sync-* platform packages were updated and others weren't (partial npm/yarn/pnpm upgrade), cached stale packages in node_modules, manual package.json overrides or resolutions pinning one platform package differently, or installing the JS wrapper from a prerelease while platform packages resolve to different prerelease versions.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Native binding package version mismatch, expected 0.8.0-pre.
- Unknown result type: ${resultKind}
- Unknown column type: ${kind}
- @tursodatabase/sync-react-native: JSI bindings not found on
- jsContextPointer == 0
AI-assisted analysis of tursodatabase/turso@492c4a71cd (2026-09-13).
Data as JSON: /api/errors/41d3e0ca82029c7e.
Report an issue: GitHub.