{"record":{"id":"52e6243f75131ed4","repo":"tursodatabase/turso","slug":"native-binding-package-version-mismatch-expected-0-8-0-pre-52e624","errorCode":null,"errorMessage":"Native binding package version mismatch, expected 0.8.0-pre.11 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.","messagePattern":"Native binding package version mismatch, expected 0\\.8\\.0-pre\\.11 but got (.+?)\\. You can reinstall dependencies to fix this issue\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"bindings/javascript/packages/native/index.js","lineNumber":85,"sourceCode":"function requireNative() {\n  if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {\n    try {\n      nativeBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);\n    } catch (err) {\n      loadErrors.push(err)\n    }\n  } else if (process.platform === 'android') {\n    if (process.arch === 'arm64') {\n      try {\n        return require('./turso.android-arm64.node')\n      } catch (e) {\n        loadErrors.push(e)\n      }\n      try {\n        const binding = require('@tursodatabase/database-android-arm64')\n        const bindingPackageVersion = require('@tursodatabase/database-android-arm64/package.json').version\n        if (bindingPackageVersion !== '0.8.0-pre.11' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {\n          throw new Error(`Native binding package version mismatch, expected 0.8.0-pre.11 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)\n        }\n        return binding\n      } catch (e) {\n        loadErrors.push(e)\n      }\n    } else if (process.arch === 'arm') {\n      try {\n        return require('./turso.android-arm-eabi.node')\n      } catch (e) {\n        loadErrors.push(e)\n      }\n      try {\n        const binding = require('@tursodatabase/database-android-arm-eabi')\n        const bindingPackageVersion = require('@tursodatabase/database-android-arm-eabi/package.json').version\n        if (bindingPackageVersion !== '0.8.0-pre.11' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {\n          throw new Error(`Native binding package version mismatch, expected 0.8.0-pre.11 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)\n        }\n        return binding","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/tursodatabase/turso/blob/8d4a589f8d13ac184700d2a8f724f27e1995be3b/bindings/javascript/packages/native/index.js#L67-L103","documentation":"This is a napi-rs generated loader in @tursodatabase/database-native. When running on Android arm64 it loads the platform package @tursodatabase/database-android-arm64 and compares its package.json version against the JS wrapper's own version ('0.8.0-pre.11'). If they differ and the check is enforced (NAPI_RS_ENFORCE_VERSION_CHECK set to anything other than '0'), it throws to prevent running a native binary that may not match the JS API surface.","triggerScenarios":"Requiring @tursodatabase/database-native on process.platform==='android' && process.arch==='arm64' while the installed @tursodatabase/database-android-arm64 optional dependency has a version other than 0.8.0-pre.11, with NAPI_RS_ENFORCE_VERSION_CHECK enabled.","commonSituations":"Partial 'npm update' or lockfile merge that upgraded the JS wrapper but left the old optional dependency cached; pnpm/yarn dedupe hoisting a stale platform package; a mixed install after switching npm registries or using an outdated mirror.","solutions":["Reinstall dependencies from a clean state: rm -rf node_modules && npm install (or the equivalent for your package manager) so the platform package version matches 0.8.0-pre.11.","Check the installed version with `npm ls @tursodatabase/database-android-arm64` and explicitly install @tursodatabase/database-android-arm64@0.8.0-pre.11.","Clear the package manager cache (npm cache clean --force / pnpm store prune) if a stale 0.8.0-pre.X tarball keeps being resolved.","Set NAPI_RS_ENFORCE_VERSION_CHECK=0 to skip the check only if you knowingly run a mismatched native binary (not recommended)."],"exampleFix":"// before (package.json)\n\"dependencies\": { \"@tursodatabase/database-native\": \"^0.8.0-pre.11\" }\n\n// after: pin wrapper and platform package to the same version\nnpm install @tursodatabase/database-native@0.8.0-pre.11\nnpm install @tursodatabase/database-android-arm64@0.8.0-pre.11","handlingStrategy":"try-catch","validationCode":"const wrapperPkg = require('@tursodatabase/database-native/package.json');\nlet platformPkg;\ntry { platformPkg = require('@tursodatabase/database-android-arm64/package.json'); } catch { platformPkg = null; }\nif (platformPkg && platformPkg.version !== wrapperPkg.version) {\n  throw new Error(`Install mismatch: @tursodatabase/database-android-arm64@${platformPkg.version} vs wrapper@${wrapperPkg.version}. Reinstall dependencies.`);\n}","typeGuard":"const isMatchingBinding = (pkg) => !!pkg && typeof pkg.version === 'string' && pkg.version === require('@tursodatabase/database-native/package.json').version;","tryCatchPattern":"let binding;\ntry {\n  binding = require('@tursodatabase/database-native');\n} catch (e) {\n  if (String(e.message).includes('Native binding package version mismatch')) {\n    console.error('Native/JS version mismatch: run `rm -rf node_modules && npm install` to realign @tursodatabase platform packages.');\n  }\n  throw e;\n}","preventionTips":["Install @tursodatabase/database-native and all platform packages with exact (non-range) versions in package.json.","Commit a single lockfile and reinstall node_modules whenever the package version changes.","In CI, start from a fresh node_modules instead of caching across release upgrades, or key the cache on the lockfile hash.","Run a startup smoke test that requires the package so mismatches fail the build, not production."],"tags":["nodejs","version-mismatch","native-binding","dependency-management"],"backgroundTag":"type-mismatch","analyzedSha":"8d4a589f8d13ac184700d2a8f724f27e1995be3b","analyzedAt":"2026-09-20T13:18:14.658Z","contentChangedAt":"2026-09-20T13:18:14.658Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}