React Native 0.60 use_native_modules!

,

Hi Everyone,

Recently upgrade to react-native 0.60 which uses autolinking via use_native_modules however I consistently run into the following issue when running bundle exec pod install --verbose:

Invalid `Podfile` file: 785: unexpected token at '{
...
 #  from /Users/distiller/app/ios/Podfile:50
 #  -------------------------------------------
 #  
 >    use_native_modules!
 #  end
 #  -------------------------------------------

Is there anyway around this? I have tried to ensure that the versions of node, ruby, bundler, cocoapods and yarn are on the same version as my local.

Here is my circleci config for this job:

version: 2
jobs:
...
  ios:
    macos:
      xcode: "10.2.1"
    working_directory: ~/app

    # use a --login shell so our "set Ruby version" command gets picked up for later steps
    shell: /bin/bash --login -o pipefail

    steps:
      - checkout

      - run:
          name: Upgrade Yarn
          command: |
            curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash -s -- --no-use
            echo 'export NVM_DIR=$HOME/.nvm' >> $BASH_ENV
            echo 'source $NVM_DIR/nvm.sh' >> $BASH_ENV
            echo 'nvm install v12.6.0' >> $BASH_ENV
            echo 'nvm alias default v12.6.0' >> $BASH_ENV
            curl -o- https://yarnpkg.com/install.sh | bash -s
            echo 'export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"' >> $BASH_ENV

      - run:
          name: set Ruby version
          command:  echo "ruby-2.4" > ~/.ruby-version

      - restore_cache:
          key: yarn-v1-{{ checksum "yarn.lock" }}-{{ arch }}

      - restore_cache:
          key: node-v1-{{ checksum "package.json" }}-{{ arch }}

      # not using a workspace here as Node and Yarn versions
      # differ between our macOS executor image and the Docker containers above
      - run: yarn install

      - save_cache:
          key: yarn-v1-{{ checksum "yarn.lock" }}-{{ arch }}
          paths:
            - ~/.cache/yarn

      - save_cache:
          key: node-v1-{{ checksum "package.json" }}-{{ arch }}
          paths:
            - node_modules

      - restore_cache:
          key: bundle-v1-{{ checksum "ios/Gemfile.lock" }}-{{ arch }}

      - run:
          command: bundle install
          working_directory: ios

      - save_cache:
          key: bundle-v1-{{ checksum "ios/Gemfile.lock" }}-{{ arch }}
          paths:
            - vendor/bundle

      - restore_cache:
          key: pods-v1-{{ checksum "ios/Podfile.lock" }}-{{ arch }}

      - run:
          name: show versions
          working_directory: ios
          command: |
            node -v
            ruby -v
            bundle exec pod --version
            yarn --version
            bundle --version

      - run:
          name: Install CocoaPods
          command: bundle exec pod install --verbose
          working_directory: ios

      - save_cache:
          key: pods-v1-{{ checksum "ios/Podfile.lock" }}-{{ arch }}
          paths:
            - ios/Pods

      - run:
          command: bundle exec fastlane test
          working_directory: ios

      - run:
          name: set up test results
          working_directory: ios
          when: always
          command: |
            mkdir -p test-results/fastlane test-results/xcode
            mv fastlane/report.xml test-results/fastlane
            mv fastlane/test_output/report.junit test-results/xcode/junit.xml
            
      - store_test_results:
          path: ios/test-results

      - store_artifacts:
          path: ios/test-results
...

Hey! I am also running into the same issue and posted it as an issue on the react native CLI github issues section: https://github.com/react-native-community/cli/issues/576.

This has now been solved here: https://github.com/react-native-community/cli/pull/578 and version 2.8.0

@raen79 I’m still having this issue. I’ve installed @react-native-community/cli@2.8.0 , but am still seeing this error on CircleCI.

FYI when I SSH into the CircleCI instance and run bundle exec pod install manually, it works fine.