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

cli-platform-ios pod install failure #823

Closed
cormander opened this issue Oct 24, 2019 · 13 comments
Closed

cli-platform-ios pod install failure #823

cormander opened this issue Oct 24, 2019 · 13 comments

Comments

@cormander
Copy link

Environment

$ react-native info
info Fetching system and libraries information...
System:
    OS: macOS 10.15
    CPU: (12) x64 Intel(R) Core(TM) i7-8700B CPU @ 3.20GHz
    Memory: 7.31 GB / 32.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 10.16.3 - /usr/local/bin/node
    npm: 6.12.0 - /usr/local/bin/npm
  SDKs:
    iOS SDK:
      Platforms: iOS 13.1, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0
    Android SDK:
      API Levels: 23, 25, 27, 28, 29
      Build Tools: 28.0.3, 29.0.1, 29.0.2
      System Images: android-28 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5900203
    Xcode: 11.1/11A1027 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.11.0 => 16.11.0 
    react-native: 0.61.2 => 0.61.2

Description

On a current project, after removing the package-lock.json and re-running npm install, a pod install in the ios directory fails:

$ pod install
Command `config` unrecognized. Make sure that you have run `npm install` and that you are inside a react-native project.

[!] Invalid `Podfile` file: 767: unexpected token at ''.

 #  from /Users/ourvoiceusa/git/HelloVoter/mobile/ios/Podfile:44
 #  -------------------------------------------
 #  
 >    use_native_modules!
 #  end
 #  -------------------------------------------

Reproducible Demo

git clone https://github.com/OurVoiceUSA/HelloVoter.git
cd HelloVoter/mobile
npm install
cd ios
pod install

Then if you remove package-lock.json and re-install and try the npx react-native config from the ios directory again:

rm -f package-lock.json
npm install
cd ios
pod install

I believe this is due to npx react-native config failing to work inside the ios directory on the newer version of @react-native-community/cli-platform-ios

$ cd ios
$ npx react-native config
Command `config` unrecognized. Make sure that you have run `npm install` and that you are inside a react-native project.

Here's the package-lock.json change that broke it:

@@ -1295,12 +1292,13 @@
       }
     },
     "@react-native-community/cli-platform-ios": {
-      "version": "3.0.0-alpha.2",
-      "resolved": "https://registry.npmjs.org/@react-native-community/cli-platform-ios/-/cli-platform-ios-3.0.0-alpha.2.tgz",
-      "integrity": "sha512-37FtnrWTUP0EzQ83raplcnOUlEzRCsDrsxGsUnBso33fNPBAJ4Ei6L/BuJPJZ+sCAWFbyO1XhVED0c1QuP0cww==",
+      "version": "3.0.0-alpha.7",
+      "resolved": "https://registry.npmjs.org/@react-native-community/cli-platform-ios/-/cli-platform-ios-3.0.0-alpha.7.tgz",
+      "integrity": "sha512-6qM5LpzhCEhkb9MC+nxrOHX2TxoN4qm8+Vg9byIW/wExl8dWCTneRUbQ5qFlkkMksS2U63LiRVSCXK08d6x5bA==",
       "requires": {
-        "@react-native-community/cli-tools": "^2.8.3",
+        "@react-native-community/cli-tools": "^3.0.0-alpha.7",
         "chalk": "^2.4.2",
+        "js-yaml": "^3.13.1",
         "xcode": "^2.0.0"
       },
       "dependencies": {

Thanks,

@ifyapishore
Copy link

ifyapishore commented Oct 25, 2019

Have same issue.

Check your node_modules.
image

Remove node_modules/react-native-cli. It has old version 2.0.1

Looks like after few npm installs, old version appears in node_modules somehow and broke many things.

There is an issue with resolving modules in gradle and seems like they are related.

BWT: After that react-native starts to be very slow (resolve modules on every start)

image

@cormander
Copy link
Author

Yep, that fixed it. Thank you!

@rohitpareek143
Copy link

rohitpareek143 commented Nov 15, 2019

facing same issue even after updating @react-native-community/cli.. @cormander how you solved issue

current version of "@react-native-community/cli-platform-ios" is 3.0.0

Environment

OS: macOS 10.15.1
CPU: (4) x64 Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
Memory: 4.05 GB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.4.0 - /usr/local/bin/node
Yarn: 1.19.1 - ~/.yarn/bin/yarn
npm: 6.9.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.5900203
Xcode: 11.2.1/11B500 - /usr/bin/xcodebuild
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.4 => 0.61.4

Steps to reproduce issue : -

  1. Upgrade from RN 0.59.9 to RN 0.61.4
  2. Use boilerplate Podfile - https://raw.githubusercontent.com/react-native-community/rn-diff-purge/release/0.61.4/RnDiffApp/ios/Podfile
  3. Do a pod repo update and then a pod install

@ifyapishore
Copy link

ifyapishore commented Nov 15, 2019 via email

@rohitpareek143
Copy link

rohitpareek143 commented Nov 15, 2019

@ifyapishore node_modules/react-native-cli not exists. could you please post script.

@thymikee
Copy link
Member

Check node_modules/@react-native-community/cli

@rohitpareek143
Copy link

rohitpareek143 commented Nov 15, 2019

@thymikee yeah its exist

"name": "@react-native-community/cli",
  "version": "3.0.0",

@rohitpareek143
Copy link

@thymikee @grabbou please check below react-native config details.

yarn run v1.19.1
$ ./rn-myProject/node_modules/.bin/react-native config
{
  "root": "./rn-myProject",
  "reactNativePath": "./rn-myProject/node_modules/react-native",
  "dependencies": {
    "@react-native-community/netinfo": {
      "root": "./rn-myProject/node_modules/@react-native-community/netinfo",
      "name": "@react-native-community/netinfo",
      "platforms": {
        "ios": {
          "sourceDir": "./rn-myProject/node_modules/@react-native-community/netinfo/ios",
          "folder": "./rn-myProject/node_modules/@react-native-community/netinfo",
          "pbxprojPath": "./rn-myProject/node_modules/@react-native-community/netinfo/ios/RNCNetInfo.xcodeproj/project.pbxproj",
          "podfile": null,
          "podspecPath": "./rn-myProject/node_modules/@react-native-community/netinfo/react-native-netinfo.podspec",
          "projectPath": "./rn-myProject/node_modules/@react-native-community/netinfo/ios/RNCNetInfo.xcodeproj",
          "projectName": "RNCNetInfo.xcodeproj",
          "libraryFolder": "Libraries",
          "sharedLibraries": [],
          "plist": [],
          "scriptPhases": []
        },
        "android": {
          "sourceDir": "./rn-myProject/node_modules/@react-native-community/netinfo/android",
          "folder": "./rn-myProject/node_modules/@react-native-community/netinfo",
          "packageImportPath": "import com.reactnativecommunity.netinfo.NetInfoPackage;",
          "packageInstance": "new NetInfoPackage()"
        }
      },
      "assets": [],
      "hooks": {},
      "params": []
    },
    "react-native-charts-wrapper": {
      "root": "./rn-myProject/node_modules/react-native-charts-wrapper",
      "name": "react-native-charts-wrapper",
      "platforms": {
        "ios": null,
        "android": {
          "sourceDir": "./rn-myProject/node_modules/react-native-charts-wrapper/android",
          "folder": "./rn-myProject/node_modules/react-native-charts-wrapper",
          "packageImportPath": "import com.github.wuxudong.rncharts.MPAndroidChartPackage;",
          "packageInstance": "new MPAndroidChartPackage()"
        }
      },
      "assets": [],
      "hooks": {},
      "params": []
    },
    "react-native-device-info": {
      "root": "./rn-myProject/node_modules/react-native-device-info",
      "name": "react-native-device-info",
      "platforms": {
        "ios": {
          "sourceDir": "./rn-myProject/node_modules/react-native-device-info/ios",
          "folder": "./rn-myProject/node_modules/react-native-device-info",
          "pbxprojPath": "./rn-myProject/node_modules/react-native-device-info/ios/RNDeviceInfo.xcodeproj/project.pbxproj",
          "podfile": null,
          "podspecPath": "./rn-myProject/node_modules/react-native-device-info/RNDeviceInfo.podspec",
          "projectPath": "./rn-myProject/node_modules/react-native-device-info/ios/RNDeviceInfo.xcodeproj",
          "projectName": "RNDeviceInfo.xcodeproj",
          "libraryFolder": "Libraries",
          "sharedLibraries": [],
          "plist": [],
          "scriptPhases": []
        },
        "android": {
          "sourceDir": "./rn-myProject/node_modules/react-native-device-info/android",
          "folder": "./rn-myProject/node_modules/react-native-device-info",
          "packageImportPath": "import com.learnium.RNDeviceInfo.RNDeviceInfo;",
          "packageInstance": "new RNDeviceInfo()"
        }
      },
      "assets": [],
      "hooks": {},
      "params": []
    },
    "react-native-email-link": {
      "root": "./rn-myProject/node_modules/react-native-email-link",
      "name": "react-native-email-link",
      "platforms": {
        "ios": null,
        "android": {
          "sourceDir": "./rn-myProject/node_modules/react-native-email-link/android",
          "folder": "./rn-myProject/node_modules/react-native-email-link",
          "packageImportPath": "import com.facebook.react.modules.email.EmailPackage;",
          "packageInstance": "new EmailPackage()"
        }
      },
      "assets": [],
      "hooks": {},
      "params": []
    },
    "react-native-gesture-handler": {
      "root": "./rn-myProject/node_modules/react-native-gesture-handler",
      "name": "react-native-gesture-handler",
      "platforms": {
        "ios": {
          "sourceDir": "./rn-myProject/node_modules/react-native-gesture-handler/ios",
          "folder": "./rn-myProject/node_modules/react-native-gesture-handler",
          "pbxprojPath": "./rn-myProject/node_modules/react-native-gesture-handler/ios/RNGestureHandler.xcodeproj/project.pbxproj",
          "podfile": null,
          "podspecPath": "./rn-myProject/node_modules/react-native-gesture-handler/RNGestureHandler.podspec",
          "projectPath": "./rn-myProject/node_modules/react-native-gesture-handler/ios/RNGestureHandler.xcodeproj",
          "projectName": "RNGestureHandler.xcodeproj",
          "libraryFolder": "Libraries",
          "sharedLibraries": [],
          "plist": [],
          "scriptPhases": []
        },
        "android": {
          "sourceDir": "./rn-myProject/node_modules/react-native-gesture-handler/android",
          "folder": "./rn-myProject/node_modules/react-native-gesture-handler",
          "packageImportPath": "import com.swmansion.gesturehandler.react.RNGestureHandlerPackage;",
          "packageInstance": "new RNGestureHandlerPackage()"
        }
      },
      "assets": [],
      "hooks": {},
      "params": []
    },
    "react-native-linear-gradient": {
      "root": "./rn-myProject/node_modules/react-native-linear-gradient",
      "name": "react-native-linear-gradient",
      "platforms": {
        "ios": {
          "sourceDir": "./rn-myProject/node_modules/react-native-linear-gradient",
          "folder": "./rn-myProject/node_modules/react-native-linear-gradient",
          "pbxprojPath": "./rn-myProject/node_modules/react-native-linear-gradient/BVLinearGradient.xcodeproj/project.pbxproj",
          "podfile": null,
          "podspecPath": "./rn-myProject/node_modules/react-native-linear-gradient/BVLinearGradient.podspec",
          "projectPath": "./rn-myProject/node_modules/react-native-linear-gradient/BVLinearGradient.xcodeproj",
          "projectName": "BVLinearGradient.xcodeproj",
          "libraryFolder": "Libraries",
          "sharedLibraries": [],
          "plist": [],
          "scriptPhases": []
        },
        "android": {
          "sourceDir": "./rn-myProject/node_modules/react-native-linear-gradient/android",
          "folder": "./rn-myProject/node_modules/react-native-linear-gradient",
          "packageImportPath": "import com.BV.LinearGradient.LinearGradientPackage;",
          "packageInstance": "new LinearGradientPackage()"
        }
      },
      "assets": [],
      "hooks": {},
      "params": []
    },
       "react-native-vector-icons": {
      "root": "./rn-myProject/node_modules/react-native-vector-icons",
      "name": "react-native-vector-icons",
      "platforms": {
        "ios": {
          "sourceDir": "./rn-myProject/node_modules/react-native-vector-icons",
          "folder": "./rn-myProject/node_modules/react-native-vector-icons",
          "pbxprojPath": "./rn-myProject/node_modules/react-native-vector-icons/RNVectorIcons.xcodeproj/project.pbxproj",
          "podfile": null,
          "podspecPath": "./rn-myProject/node_modules/react-native-vector-icons/RNVectorIcons.podspec",
          "projectPath": "./rn-myProject/node_modules/react-native-vector-icons/RNVectorIcons.xcodeproj",
          "projectName": "RNVectorIcons.xcodeproj",
          "libraryFolder": "Libraries",
          "sharedLibraries": [],
          "plist": [],
          "scriptPhases": []
        },
        "android": {
          "sourceDir": "./rn-myProject/node_modules/react-native-vector-icons/android",
          "folder": "./rn-myProject/node_modules/react-native-vector-icons",
          "packageImportPath": "import com.oblador.vectoricons.VectorIconsPackage;",
          "packageInstance": "new VectorIconsPackage()"
        }
      },
      "assets": [],
      "hooks": {},
      "params": []
    },
    "react-native-webview": {
      "root": "./rn-myProject/node_modules/react-native-webview",
      "name": "react-native-webview",
      "platforms": {
        "ios": {
          "sourceDir": "./rn-myProject/node_modules/react-native-webview/ios",
          "folder": "./rn-myProject/node_modules/react-native-webview",
          "pbxprojPath": "./rn-myProject/node_modules/react-native-webview/ios/RNCWebView.xcodeproj/project.pbxproj",
          "podfile": null,
          "podspecPath": "./rn-myProject/node_modules/react-native-webview/react-native-webview.podspec",
          "projectPath": "./rn-myProject/node_modules/react-native-webview/ios/RNCWebView.xcodeproj",
          "projectName": "RNCWebView.xcodeproj",
          "libraryFolder": "Libraries",
          "sharedLibraries": [],
          "plist": [],
          "scriptPhases": []
        },
        "android": {
          "sourceDir": "./rn-myProject/node_modules/react-native-webview/android",
          "folder": "./rn-myProject/node_modules/react-native-webview",
          "packageImportPath": "import com.reactnativecommunity.webview.RNCWebViewPackage;",
          "packageInstance": "new RNCWebViewPackage()"
        }
      },
      "assets": [],
      "hooks": {},
      "params": []
    },
  "commands": [
    {
      "name": "log-ios",
      "description": "starts iOS device syslog tail"
    },
    {
      "name": "run-ios",
      "description": "builds your app and starts it on iOS simulator",
      "examples": [
        {
          "desc": "Run on a different simulator, e.g. iPhone 5",
          "cmd": "react-native run-ios --simulator \"iPhone 5\""
        },
        {
          "desc": "Pass a non-standard location of iOS directory",
          "cmd": "react-native run-ios --project-path \"./app/ios\""
        },
        {
          "desc": "Run on a connected device, e.g. Max's iPhone",
          "cmd": "react-native run-ios --device \"Max's iPhone\""
        },
        {
          "desc": "Run on the AppleTV simulator",
          "cmd": "react-native run-ios --simulator \"Apple TV\"  --scheme \"helloworld-tvOS\""
        }
      ],
      "options": [
        {
          "name": "--simulator [string]",
          "description": "Explicitly set simulator to use. Optionally include iOS version betweenparenthesis at the end to match an exact version: \"iPhone 6 (10.0)\"",
          "default": "iPhone 11"
        },
        {
          "name": "--configuration [string]",
          "description": "Explicitly set the scheme configuration to use",
          "default": "Debug"
        },
        {
          "name": "--scheme [string]",
          "description": "Explicitly set Xcode scheme to use"
        },
        {
          "name": "--project-path [string]",
          "description": "Path relative to project root where the Xcode project (.xcodeproj) lives.",
          "default": "ios"
        },
        {
          "name": "--device [string]",
          "description": "Explicitly set device to use by name.  The value is not required if you have a single device connected."
        },
        {
          "name": "--udid [string]",
          "description": "Explicitly set device to use by udid"
        },
        {
          "name": "--no-packager",
          "description": "Do not launch packager while building"
        },
        {
          "name": "--verbose",
          "description": "Do not use xcpretty even if installed"
        },
        {
          "name": "--port [number]",
          "default": 8081
        },
        {
          "name": "--terminal [string]",
          "description": "Launches the Metro Bundler in a new window using the specified terminal path."
        }
      ]
    },
    {
      "name": "log-android",
      "description": "starts logkitty"
    },
    {
      "name": "run-android",
      "description": "builds your app and starts it on a connected Android emulator or device",
      "options": [
        {
          "name": "--root [string]",
          "description": "Override the root directory for the android build (which contains the android directory)",
          "default": ""
        },
        {
          "name": "--variant [string]",
          "description": "Specify your app's build variant",
          "default": "debug"
        },
        {
          "name": "--appFolder [string]",
          "description": "Specify a different application folder name for the android source. If not, we assume is \"app\"",
          "default": "app"
        },
        {
          "name": "--appId [string]",
          "description": "Specify an applicationId to launch after build.",
          "default": ""
        },
        {
          "name": "--appIdSuffix [string]",
          "description": "Specify an applicationIdSuffix to launch after build.",
          "default": ""
        },
        {
          "name": "--main-activity [string]",
          "description": "Name of the activity to start",
          "default": "MainActivity"
        },
        {
          "name": "--deviceId [string]",
          "description": "builds your app and starts it on a specific device/simulator with the given device id (listed by running \"adb devices\" on the command line)."
        },
        {
          "name": "--no-packager",
          "description": "Do not launch packager while building"
        },
        {
          "name": "--port [number]",
          "default": 8081
        },
        {
          "name": "--terminal [string]",
          "description": "Launches the Metro Bundler in a new window using the specified terminal path.",
          "default": "Apple_Terminal"
        },
        {
          "name": "--tasks [list]",
          "description": "Run custom Gradle tasks. By default it's \"installDebug\""
        },
        {
          "name": "--no-jetifier",
          "description": "Do not run \"jetifier\" – the AndroidX transition tool. By default it runs before Gradle to ease working with libraries that don't support AndroidX yet. See more at: https://www.npmjs.com/package/jetifier.",
          "default": false
        }
      ]
    }
  ],
  "assets": [],
  "platforms": {
    "ios": {},
    "android": {}
  },
  "haste": {
    "providesModuleNodeModules": [
      "react-native"
    ],
    "platforms": [
      "ios",
      "android"
    ]
  },
  "project": {
    "ios": {
      "sourceDir": "./rn-myProject/ios",
      "folder": "./rn-myProject",
      "pbxprojPath": "./rn-myProject/ios/myProject.xcodeproj/project.pbxproj",
      "podfile": "./rn-myProject/ios/Podfile",
      "podspecPath": null,
      "projectPath": "./rn-myProject/ios/myProject.xcodeproj",
      "projectName": "myProject.xcodeproj",
      "libraryFolder": "Libraries",
      "sharedLibraries": [],
      "plist": [],
      "scriptPhases": []
    },
    "android": {
      "sourceDir": "./rn-myProject/android/app",
      "isFlat": false,
      "folder": "./rn-myProject",
      "stringsPath": "./rn-myProject/android/app/src/main/res/values/strings.xml",
      "manifestPath": "./rn-myProject/android/app/src/main/AndroidManifest.xml",
      "buildGradlePath": "./rn-myProject/android/app/build.gradle",
      "settingsGradlePath": "./rn-myProject/android/settings.gradle",
      "assetsPath": "./rn-myProject/android/app/src/main/assets",
      "mainFilePath": "./rn-myProject/android/app/src/main/java/com/rnmyProject/MainApplication.java",
      "packageName": "com.rnmyProject"
    }
  }
}

@aniruddhashevle
Copy link

@thymikee @grabbou @rohitpareek143 : This issue is still there! Any solution for this?

@CyberMew
Copy link

CyberMew commented Dec 6, 2019

Getting this as well after I did npm install, no issues yesterday, someone changed something that broke it i guess. The only sign I got was

npm WARN rm not removing /Users/cm/Desktop/mym1/mym1-react-native/node_modules/.bin/react-native as it wasn't installed by /Users/cm/Desktop/mym1/mym1-react-native/node_modules/@react-native-community/cli

I removed it manually, and pod install still gives the same error. iOS podfile/project was not modified at all.

The podfile line in question is: use_native_modules!($rnpath)

@aniruddhashevle
Copy link

I removed react-native-cli globally,
yarn global remove react-native-cli

Then pod install worked for me!

@jaypeng2015
Copy link

Removing react-native-cli saved me.

This is in New application, but maybe not in the migration guide.
image

@marcosflp
Copy link

Had the same problem but was because was trying to install inside yarn workspaces. Installing outside worked.

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

No branches or pull requests

8 participants