expo-share-intent: Request for additional guidance on: TypeError: [ios.xcodeproj]: withIosXcodeprojBaseMod: Cannot read properties of null (reading 'path')

Describe the bug I am experiencing the documented issue regarding a post-install script: TypeError: [ios.xcodeproj]: withIosXcodeprojBaseMod: Cannot read properties of null (reading 'path')

To Reproduce I am attempting to run: npx expo prebuild --no-install --clean

** Environment ** give the output of the following command npx react-native info info Fetching system and libraries information… System: OS: Linux 6.5 Ubuntu 23.10 23.10 (Mantic Minotaur) CPU: (8) x64 Intel® Core™ i7-1065G7 CPU @ 1.30GHz Memory: 4.30 GB / 15.20 GB Shell: version: 5.2.15 path: /bin/bash Binaries: Node: version: 18.18.0 path: ~/.nvm/versions/node/v18.18.0/bin/node Yarn: version: 1.22.21 path: ~/.nvm/versions/node/v18.18.0/bin/yarn npm: version: 10.5.0 path: ~/.nvm/versions/node/v18.18.0/bin/npm Watchman: Not Found SDKs: Android SDK: Not Found IDEs: Android Studio: Not Found Languages: Java: Not Found Ruby: Not Found npmPackages: “@react-native-community/cli”: Not Found react: installed: 18.2.0 wanted: 18.2.0 react-native: installed: 0.73.4 wanted: 0.73.4 npmGlobalPackages: “react-native”: Not Found Android: hermesEnabled: true newArchEnabled: false iOS: hermesEnabled: Not found newArchEnabled: false

info React Native v0.73.5 is now available (your project is running on v0.73.4). info Changelog: https://github.com/facebook/react-native/releases/tag/v0.73.5 info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.73.5 info For more info, check out “https://reactnative.dev/docs/upgrading?os=linux”.

Additional context I have looked at the patch file but an not sure where to apply this change (I have searched under node_modules for files containing “xcode” to see if I could patch there but I haven’t found the indicated line of code.

I have also looked at the linked issue and added the suggested override to my package.json however I still get the error message.

I’m really pleased to have found your package as I would love to be able to share URLs to my app. Any pointers you can offer will be very much appreciated!

  • expo version (ex: ^50.0.8)
  • routing : react-navigation
  • package version (ex: 0.1.0)
  • target : Android & iOS
  • device : Android emulator, real Android and iOS
  • type: local build (in preparation for expo build)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 20 (6 by maintainers)

Most upvoted comments

@achorein Side question:

Why do we need the xcode patch? Can we use expo-share-intent without the xcode patch? Do we need to wait until the expo-cli issue is fixed (https://github.com/expo/expo-cli/issues/4293), or is there another solution?

I got it working on Expo and tested on iOS/Android—everything works as expected. I was just wondering if new developers can simply do: • yarn add expo-share-intent • configure app.json

…and be good to go without needing the xcode patch or adding “postinstall”: “patch-package”, etc.

I also noticed that the folks over at BlueSky Social have it working for themselves, though they haven’t made a plugin for public use yet. I believe their app is used by many users, potentially around 1 million.

👋

package resolution is not needed, the xcode dependency is already the latest.

the readme is not crystal clear about the require patch, can you try to follow these steps :

  • copy the patch in you patches project directory (like example)

  • reset dependencies and add patch-package for auto patching

rm -fr node_modules
yarn add patch-package
  • add post-install script
  "scripts": {
    ...
    "postinstall": "patch-package"
  },
  • Reinstall dependencies and check that the applied patch is correct :
$ yarn install
yarn install v1.22.19
[1/4] 🔍  Resolving packages...
success Already up-to-date.
$ patch-package
patch-package 8.0.0
Applying patches...
xcode@3.0.1 ✔
✨  Done in 0.81s.
  • run prebuild command
$ yarn expo prebuild --no-install
yarn run v1.22.19
$ /Users/anselme/project/expo-share-intent/expo-share-intent-plugin/example/basic/node_modules/.bin/expo prebuild --no-install
✔ Created native directories | reusing /android, /ios
✔ Updated package.json | no changes
⠦ Running prebuild[expo-share-intent] add ios share extension (scheme:exposhareintentexample appIdentifier:expo.modules.exposhareintent.example)
⠇ Running prebuild[expo-share-intent] add android filters (text/* image/*) and multi-filters (image/*)
» android: userInterfaceStyle: Install expo-system-ui in your project to enable this feature.
✔ Finished prebuild
✨  Done in 3.94s.

Did anyone get it to work with PNPM?

For pnpm you don’t need to add patch-package, simple use the built-in patch system of pnpm, doc here Take a look on this video, in my case I’ve created the patch again as I’m on a mono-repo repository.

pnpm patch command

@achorein nevermind, just didnt read the docs properly

Still having the same issue on v3.0.0 with expo 52 and @expo/cli installed

after some digging, you need to have @expo/cli package in your dependencies to allow “patch-package” to work. when globaly installed the npm cache is not updated.

Your are welcome, i also updated the README 👍

Success! Thank you so much for taking the time to document this.

I applied the steps as you described and have successfiully run prebuild.

Fantastic work - your package has landed at the exact time I needed this solution, I’m very grateful for what you’ve created.