ERROR Cannot read properties of undefined (reading 'configurations'). TypeError: Cannot read properties of undefined (reading 'configurations')

Viewed 2539

I installed @react-native-community/cli-platform-android in my react-native project, now I am getting "error Cannot read properties of undefined (reading 'configurations'). TypeError: Cannot read properties of undefined (reading 'configurations')" on running npm run android.

2 Answers

if the issue happening for you on react native v0.68.2, you should change the file under:

node_modules/@react-native-community/cli-platform-ios/build/config/index.js

(was line 102 for me).

function dependencyConfig(folder, userConfig) {
// const configurations = userConfig.configurations || [];
    let configurations="";

this fixes the crash due to userConfig being empty (not sure if it's a bug or bad config)

then run react-native run-android normally

Patch node_modules/@react-native-community/cli-platform-ios/build/config/index.js

like this:

-  const configurations = userConfig.configurations || [];
+  let configurations = [];
+  if(userConfig) {
+    configurations = userConfig.configurations || [];
+  }

Not sure why this is needed, but it works.

Related