Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to install dependency #401

Open
K-sivasankar opened this issue Jan 28, 2025 · 6 comments
Open

Unable to install dependency #401

K-sivasankar opened this issue Jan 28, 2025 · 6 comments

Comments

@K-sivasankar
Copy link

Hi , I created New react native app with following steps, I installed all pre request like npm, forcereact and etc.
Step1 . Created project with 'forcereact create' and completed the all dependency installation and run the app in ios and android, After that , I try to add any library like npm install 'library name'. I am facing the error

npm error code 1
npm error git dep preparation failed
npm error command /usr/local/bin/node /usr/local/lib/node_modules/npm/bin/npm-cli.js install --force --cache=/Users/sivasankark/.npm --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run
npm error > [email protected] prepublish
npm error > npm run build
npm error
npm error
npm error > [email protected] build
npm error > tsc --build
npm error
npm error error TS2688: Cannot find type definition file for 'react-native'.
npm error The file is in the program because:
npm error Entry point of type library 'react-native' specified in compilerOptions
npm error npm warn using --force Recommended protections disabled.

Note: I am installed force react v12.2.0 and Setup salesforce sdk v12.2.0 and react native force V12.2.0

I tried with adding "@types/react-native": "0.73.0", in my package.json. But it is not worked, Any one have solution for this?

@wmathurin
Copy link
Contributor

@K-sivasankar something is off.
forcereact 12.2 should bring in [email protected] (13.0 has not been released yet).
Also MSDK 12.2 uses React Native 0.74.5.

Could you run forcereact version from the command line to see what it returns?

@K-sivasankar
Copy link
Author

Hi @wmathurin , Yes, I tried with new project setup again , now It is showing same error for [email protected]. Also my current forcereact version is 12.2.0.

Note: I Referred #376. But it is not works.
i know @types/react-native is deprecated and in react version 0.73 above has default behaviour for this. If i downgrade every thing to 11.0.0 I can Install all dependency, But I want to use latest salesforce sdk version 12.2.0 in my project.
Also I tried the trick, I just update sdk version from my 11.0.0 project by using 'node installios.js' after editing my sdk version in package.json. But I am facing some other errors, to fix this again i want to update React native version form 0.70.0, to 0.74.5. Again same issue is coming.

@sidhu18
Copy link

sidhu18 commented Feb 6, 2025

@K-sivasankar I had the same issue, not sure about whats causing this, but I managed to make the setup work by forking the project and adding the types definition to package.json.

You can test it out, by using my fork of SDK repo here; https://github.com/sidhu18/SalesforceMobileSDK-ReactNative/tree/master

Usage:
"react-native-force": "git+https://github.com/sidhu18/SalesforceMobileSDK-ReactNative.git#v12.2.0",

@K-sivasankar
Copy link
Author

K-sivasankar commented Feb 10, 2025

Okay @sidhu18 Let me try it out.

Edited: I installed dependency library then i run pod install for ios. I am receiving following error, seems like there is issue in Ruby. Do you have any idea to resolve it, i tried some solution from search, nothing work.

/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': dlopen(/Library/Ruby/Gems/2.6.0/gems/strscan-3.1.0/lib/strscan.bundle, 0x0009): tried: '/Library/Ruby/Gems/2.6.0/gems/strscan-3.1.0/lib/strscan.bundle' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Library/Ruby/Gems/2.6.0/gems/strscan-3.1.0/lib/strscan.bundle' (no such file), '/Library/Ruby/Gems/2.6.0/gems/strscan-3.1.0/lib/strscan.bundle' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')) - /Library/Ruby/

@sidhu18
Copy link

sidhu18 commented Feb 20, 2025

Okay @sidhu18 Let me try it out.

Edited: I installed dependency library then i run pod install for ios. I am receiving following error, seems like there is issue in Ruby. Do you have any idea to resolve it, i tried some solution from search, nothing work.

/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': dlopen(/Library/Ruby/Gems/2.6.0/gems/strscan-3.1.0/lib/strscan.bundle, 0x0009): tried: '/Library/Ruby/Gems/2.6.0/gems/strscan-3.1.0/lib/strscan.bundle' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Library/Ruby/Gems/2.6.0/gems/strscan-3.1.0/lib/strscan.bundle' (no such file), '/Library/Ruby/Gems/2.6.0/gems/strscan-3.1.0/lib/strscan.bundle' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')) - /Library/Ruby/

If you are using M-chip based macs, then this could be fixed by adding arm64 to the EXCLUDED_ARCHITECTURE in Pods.

ref: https://stackoverflow.com/questions/63607158/xcode-building-for-ios-simulator-but-linking-in-an-object-file-built-for-ios-f

@K-sivasankar
Copy link
Author

K-sivasankar commented Feb 21, 2025

Hi @sidhu18 , It is not related with app running issue, It is related with add additional library in my project. any way i will try this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants