expo-cli
expo-cli copied to clipboard
[ios.xcodeproj]: withIosXcodeprojBaseMod: Cannot read properties of null (reading 'path')
Summary
There is a mismatch in the pbxProject.js file between what's in expo-cli and the cordova-node-xcode project.
Line 1682 of the version in the cordova-node-xcode project looks like:
if (project.pbxGroupByName(group) && project.pbxGroupByName(group).path)
But the same line in the expo-cli looks like:
if (project.pbxGroupByName(group).path)
Which means that if the group is not found, it will automatically error out instead of just skipping the check. This blocks other code in the file that focuses on creating the group if it's not found.
Environment
expo-env-info 1.0.2 environment info: System: OS: macOS 12.3.1 Shell: 5.8 - /bin/zsh Binaries: Node: 16.13.2 - ~/.nvm/versions/node/v16.13.2/bin/node Yarn: 1.22.18 - /usr/local/bin/yarn npm: 8.6.0 - ~/.nvm/versions/node/v16.13.2/bin/npm Watchman: 2022.03.21.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5 IDEs: Android Studio: 2021.1 AI-211.7628.21.2111.8092744 Xcode: 13.3/13E113 - /usr/bin/xcodebuild npmPackages: expo: ~44.0.4 => 44.0.5 react: 17.0.1 => 17.0.1 react-dom: 17.0.1 => 17.0.1 react-native: 0.64.3 => 0.64.3 react-native-web: 0.17.1 => 0.17.1 npmGlobalPackages: eas-cli: 0.48.2 expo-cli: 5.3.0 Expo Workflow: bare
Please specify your device/emulator/simulator platform, model and version
n/a
Error output
✖ Config sync failed [ios.xcodeproj]: withIosXcodeprojBaseMod: Cannot read properties of null (reading 'path') TypeError: [ios.xcodeproj]: withIosXcodeprojBaseMod: Cannot read properties of null (reading 'path') at correctForPath (/Users/brendanvinson/.nvm/versions/node/v16.13.2/lib/node_modules/expo-cli/node_modules/xcode/lib/pbxProject.js:1682:38) at correctForResourcesPath (/Users/brendanvinson/.nvm/versions/node/v16.13.2/lib/node_modules/expo-cli/node_modules/xcode/lib/pbxProject.js:1672:12) at pbxProject.addResourceFile (/Users/brendanvinson/.nvm/versions/node/v16.13.2/lib/node_modules/expo-cli/node_modules/xcode/lib/pbxProject.js:258:9)
✖ Config sync failed [ios.xcodeproj]: withIosXcodeprojBaseMod: Cannot read properties of null (reading 'path') TypeError: [ios.xcodeproj]: withIosXcodeprojBaseMod: Cannot read properties of null (reading 'path') at correctForPath (/Users/brendanvinson/.nvm/versions/node/v16.13.2/lib/node_modules/expo-cli/node_modules/xcode/lib/pbxProject.js:1682:38) at correctForPluginsPath (/Users/brendanvinson/.nvm/versions/node/v16.13.2/lib/node_modules/expo-cli/node_modules/xcode/lib/pbxProject.js:1668:12) at pbxProject.addPluginFile (/Users/brendanvinson/.nvm/versions/node/v16.13.2/lib/node_modules/expo-cli/node_modules/xcode/lib/pbxProject.js:106:5) at pbxProject.addHeaderFile (/Users/brendanvinson/.nvm/versions/node/v16.13.2/lib/node_modules/expo-cli/node_modules/xcode/lib/pbxProject.js:214:21)
Reproducible demo or steps to reproduce from a blank project
expoConfig = withXcodeProject(expoConfig, (config) => {
const target = IOSConfig.XcodeUtils.getApplicationNativeTarget({
project: config.modResults,
projectName: config.modRequest.projectName,
});
config.modResults.addResourceFile('PluginSDK/RCTPlugin.m', {
target: target.uuid,
});
return config;
});
can you please share a minimal reproducible example?
I've added one to the original post. 👍
thanks @schematis - can you open a pr to resolve this?
hello,
this is blocking indeed.
it seems the fix that landed into cordova-node-xcode
has never been published to npm.
In my particular use case, I circumvented the error by creating the Resources
group before using addResourceFile
, something like this:
const xcodeProject = config.modResults;
xcodeProject.pbxCreateGroup("Resources");
xcodeProject.addResourceFile(iosStoreKitConfigurationPath);
But to be honest, I don't know what I'm doing 😅
What I don't get is why the Resources
group don't exist in the first place in the pbxproj
template used in expo prebuild
?
(PS: this would be great to have proper TS support around XCodeProject
type 🤩)
Our plan to fix this is to migrate to xcparse but I don't have much time to work on the migration at the moment. It is possible to use xcparse today by implementing a config plugin in user space.
+1
This issue is stale because it has been open for 60 days with no activity. If there is no activity in the next 7 days, the issue will be closed.
This issue was closed because it has been inactive for 7 days since being marked as stale. Please open a new issue if you believe you are encountering a related problem.
any news on this? , currently running in to the same issue
Still getting this issue.
+1