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

Request for additional guidance on: TypeError: [ios.xcodeproj]: withIosXcodeprojBaseMod: Cannot read properties of null (reading 'path') #13

Closed
davidcarboni opened this issue Mar 6, 2024 · 17 comments

Comments

@davidcarboni
Copy link
Contributor

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(R) Core(TM) 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)
@achorein
Copy link
Owner

achorein commented Mar 7, 2024

👋

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.

@davidcarboni
Copy link
Contributor Author

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.

@achorein
Copy link
Owner

achorein commented Mar 9, 2024

Your are welcome, i also updated the README 👍

@achorein achorein closed this as completed Mar 9, 2024
@mcnaveen
Copy link

mcnaveen commented Jun 1, 2024

Hi @achorein I'm doing the exact steps mentioned above and still facing issues.

yarn expo prebuild --no-install
yarn run v1.22.22
$ /Users/mcnaveen/Developer/shotix/node_modules/.bin/expo prebuild --no-install
✔ Created native directories | reusing /android, /ios
✔ Updated package.json | no changes
⠙ Running prebuild************ scheme shotix
✖ Prebuild failed
TypeError: [ios.xcodeproj]: withIosXcodeprojBaseMod: Cannot read properties of null (reading 'path')
TypeError: [ios.xcodeproj]: withIosXcodeprojBaseMod: Cannot read properties of null (reading 'path')
    at correctForPath (/Users/mcnaveen/Developer/shotix/node_modules/xcode/lib/pbxProject.js:1682:38)
    at correctForResourcesPath (/Users/mcnaveen/Developer/shotix/node_modules/xcode/lib/pbxProject.js:1672:12)
    at pbxProject.addResourceFile (/Users/mcnaveen/Developer/shotix/node_modules/xcode/lib/pbxProject.js:258:9)
    at /Users/mcnaveen/Developer/shotix/node_modules/expo-config-plugin-ios-share-extension/build/withShareExtensionXcodeTarget.js:37:20
    at async action (/Users/mcnaveen/Developer/shotix/node_modules/expo-config-plugin-ios-share-extension/node_modules/@expo/config-plugins/build/plugins/withMod.js:235:23)
    at async interceptingMod (/Users/mcnaveen/Developer/shotix/node_modules/expo-config-plugin-ios-share-extension/node_modules/@expo/config-plugins/build/plugins/withMod.js:126:21)
    at async interceptingMod (/Users/mcnaveen/Developer/shotix/node_modules/@expo/config-plugins/build/plugins/withMod.js:104:21)
    at async interceptingMod (/Users/mcnaveen/Developer/shotix/node_modules/@expo/config-plugins/build/plugins/withMod.js:104:21)
    at async interceptingMod (/Users/mcnaveen/Developer/shotix/node_modules/@expo/config-plugins/build/plugins/withMod.js:104:21)
    at async interceptingMod (/Users/mcnaveen/Developer/shotix/node_modules/@expo/config-plugins/build/plugins/withMod.js:104:21)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@findmeDevepos
Copy link

me too

1 similar comment
@youngkyo0504
Copy link

me too

@youngkyo0504
Copy link

It is only working with Yarn. It is not working with npm.

@mcnaveen
Copy link

@youngkyo0504 It's not working with yarn either. I need to check again

@achorein
Copy link
Owner

Try to run patch-package command manually and recheck.
(Global install patch-package for test purpose)

@southkeys
Copy link

do u need patch-package in deps or can it go to devDeps

@markwitt1
Copy link

Did anyone get it to work with PNPM?

@achorein
Copy link
Owner

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.

@markwitt1
Copy link

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

@markwitt1
Copy link

@achorein nevermind, just didnt read the docs properly

@zholmes1
Copy link

If you have the patch set up correctly, make sure you are not using yarn expo prebuild instead of expo prebuild (globally)

@detmarson
Copy link

In my case I had to save the pbxProject file as sudo

@sultanmyrza
Copy link

@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 (expo/expo-cli#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.

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

10 participants