3
votes

I am trying to integrate latest RN project into native project. Both project are in separate directories that means my native project does not exist in predefined ios folder.

versions:

RN Native: 0.63.3 @react-native-community/cli: 4.13.0 installed globally using yarn global add @react-native-community/cli.

I am getting error stating react-native-community package not found.

My pod file is mentioned below:

require_relative '../AwesomeProject/node_modules/react-native/scripts/react_native_pods'
require_relative '../AwesomeProject/node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '10.0'

use_frameworks!


def main_pods
    config = use_native_modules!
    use_react_native!(:path => config["reactNativePath"])
end


target 'NativeFramework' do
    main_pods
end

target 'Example' do
    main_pods
end

Error:


[!] Invalid `Podfile` file: [!] /usr/local/bin/node -e try {console.log(require('@react-native-community/cli').bin);} catch (e) {console.log(require('react-native/cli').bin);}

internal/modules/cjs/loader.js:968
  throw err;
  ^

Error: Cannot find module 'react-native/cli'
2
I did but documentation seems to be outdated. Pod file does not match with upgrade tool for 0.63.3 as mentioned here: react-native-community.github.io/upgrade-helper/… - Anil Sharma
@AnilSharma did u manage to figure this out? - mike_t

2 Answers

0
votes

For some weird reason it worked with yarn install and then doing the pod install

0
votes

You say you've installed @react-native-community/cli with Yarn. The error message indicates that may not be working for you. It's not surprising, because your Podfile says it can be found in a subdirectory of your project.

Why not install with npm and see what happens?

  1. cd to AwesomeProject
  2. npm i @react-native-community/cli

Alternatively, change your Podfile so it refers to the global location.