Expo dependency error, "Cannot find native module 'ExpoCrypto'", in Non-Expo React Native Projects
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- react-native, typescript
- Domain
- mobile
Research direction
Reproduce the failure with React Native 0.73.2, cloudinary-react-native 0.2.0, and the bare-project setup described in the issue. Inspect package-lock.json and the package's Expo-related dependencies first; done means the SDK either works in a bare React Native app or documents the required workaround and supported setup.
Written by the indexing model from the issue text.
Description
I encountered an issue while integrating the cloudinary-react-native package version 0.2.0 into my bare React Native project. The problem arises due to the package's dependency on ExpoCrypto and other Expo modules, which are not available in a non-Expo (bare) React Native environment.
Steps to Reproduce
- Create a new bare React Native project using npx react-native init MyProject.
- Install the cloudinary-react-native package using npm install cloudinary-react-native.
- Attempt to use the package according to the provided documentation.
- Encounter an error related to the missing ExpoCrypto module when running the app.
Expected Behavior
I expected that the cloudinary-react-native package could be used in a bare React Native project without dependencies on Expo-specific modules, or that there would be clear documentation on how to handle such dependencies in a non-Expo environment.
import {Cloudinary} from '@cloudinary/url-gen';
import {upload} from 'cloudinary-react-native';
async function uploadImageToCloudinarySDK(payload: any) {
const {folder, upload_preset, uri} = payload;
const cld = new Cloudinary({
cloud: {cloudName: Config.CLOUDINARY_CLOUD_NAME },
url: {secure: true},
});
const options = {folder, upload_preset, unsigned: true};
await upload(cld, {
file: uri,
options,
callback: (error: any, response: any) => {
if (error) {
console.error('Upload Error:', error);
} else {
console.log('Upload Successful:', response);
}
},
}).catch((error: any) => console.log('ERROR CLD UPLOAD', error?.message));
}
Actual Behavior
The application throws an error indicating that the ExpoCrypto native module cannot be found. This suggests that the package relies on Expo modules, which are not present in bare React Native environments. The exact error message is:
Cannot find native module 'ExpoCrypto', js engine: hermes
Environment
- React Native version: 0.73.2
- Cloudinary React Native SDK version: 0.2.0
- Operating System: iOS
- Device details: iPhone 15 Pro Max
Additional Context
I am not using Expo in my project and prefer to keep it as a bare React Native application. I noticed that the package-lock.json file lists several Expo-related dependencies, which might be causing this issue.
Given the package's potential utility for React Native developers looking to integrate Cloudinary, finding a solution to make it compatible with both Expo and non-Expo environments would be greatly beneficial.
Potential Solutions or Workarounds
I am seeking guidance on how to resolve this issue. Possible solutions could include:
- Instructions on how to remove or bypass the Expo dependencies in a non-Expo environment.
- Updates to the package to support bare React Native projects without requiring Expo modules.
- Any other recommended approaches for using cloudinary-react-native in non-Expo React Native projects.
Thank you for looking into this issue. I appreciate any feedback or solutions you can provide.
- Dominant language
- TypeScript
- Stars
- 28
- Forks
- 21
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from cloudinary/cloudinary-react-native
-
hacktoberfest-accepted
Difficulty 3/5 1-2 days Newbie friendliness 45/100
cloudinary/cloudinary-react-native#55 · 3 comments ·
-
Add CODE_OF_CONDUCT.mdMay be free again @adimiz1 claimed this 406 days ago, and no pull request is open. Open
cloudinary/cloudinary-react-native#53 · 2 comments · 1 assignee ·
-
Support for expo 54Open
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
cloudinary/cloudinary-react-native#52 · 8 comments ·
-
Issue: Improve `bootstrap.js` to support both Yarn and NPM with clearer errorsPossibly taken @adimiz1 claimed this 415 days ago. Open
cloudinary/cloudinary-react-native#50 · 3 comments · 1 assignee ·
-
Difficulty 5/5 Over a week Newbie friendliness 15/100
All issues in cloudinary/cloudinary-react-native
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
bug platform-android
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Termix-SSH/Mobile#146 · 1 comment ·
Maintainers usually reply within 2 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
devswha/herdr-web-ui#3875 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
area: runtime chore cli consistency dependencies developer-experience difficulty: easy discovery documentation enhancement good first issue help wanted hygiene json-output packaging priority: P3 tests version
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day