From 8faa730769a01cc882261ef263a411a704838209 Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Thu, 20 Aug 2026 18:12:02 +0200 Subject: [PATCH] fix: Mark react-native-nitro-modules peer dependency as optional Semver ranges never match pre-releases, so a required peer of "*" does not match e.g. 0.37.0-beta.0. Package managers then install a second, stable copy of Nitro next to the pre-release, and the native/JS version guard throws "Nitro was installed twice" at runtime. Marking the peer optional leaves the consuming app in full control of the installed Nitro version. --- bun.lock | 5 ++++- packages/react-native-data-scanner/package.json | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/bun.lock b/bun.lock index e145967..1012b16 100644 --- a/bun.lock +++ b/bun.lock @@ -26,7 +26,7 @@ }, "packages/react-native-data-scanner": { "name": "react-native-data-scanner", - "version": "0.0.1", + "version": "0.1.2", "devDependencies": { "@react-native/eslint-config": "0.85.3", "@types/react": "^19.2.15", @@ -47,6 +47,9 @@ "react-native": "*", "react-native-nitro-modules": "*", }, + "optionalPeers": [ + "react-native-nitro-modules", + ], }, }, "packages": { diff --git a/packages/react-native-data-scanner/package.json b/packages/react-native-data-scanner/package.json index d460c93..dd618b5 100644 --- a/packages/react-native-data-scanner/package.json +++ b/packages/react-native-data-scanner/package.json @@ -89,6 +89,11 @@ "react-native": "*", "react-native-nitro-modules": "*" }, + "peerDependenciesMeta": { + "react-native-nitro-modules": { + "optional": true + } + }, "release-it": { "npm": { "publish": true