I've been following the initial steps to start with React Native from FB's git page at https://facebook.github.io/react-native/docs/getting-started
While using nxp or npm installed CLI during the process, I encountered the following error.
[!] Invalid `Podfile` file: [!] /Users/allen/.nvm/versions/node/v12.14.1/bin/node -e console.log(require('@react-native-community/cli').bin);
internal/modules/cjs/loader.js:796
throw err;
^
Error: Cannot find module '@react-native-community/cli'
Require stack:
- /Volumes/BLUE/workspace-blue/react_native-blue/test/ios/[eval]
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17)
at Function.Module._load (internal/modules/cjs/loader.js:686:27)
at Module.require (internal/modules/cjs/loader.js:848:19)
at require (internal/modules/cjs/helpers.js:74:18)
at [eval]:1:13
at Script.runInThisContext (vm.js:116:20)
at Object.runInThisContext (vm.js:306:38)
at Object.<anonymous> ([eval]-wrapper:9:26)
at Module._compile (internal/modules/cjs/loader.js:955:30)
at evalScript (internal/process/execution.js:80:25) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/Volumes/BLUE/workspace-blue/react_native-blue/test/ios/[eval]' ]
}
This issue occurs during cocoapods installation. The documentation states:
If you previously installed a global react-native-cli package, please remove it as it may cause unexpected issues.
However, this problem persists regardless of installations or methods used for creating the initial files.
The Podfile contains these lines:
platform :ios, '13.0' # <- originally set at 9.0 but changed to 13.0
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
If I locally install @react-native-commuinty/cli within the project and then run pod install
, everything works correctly. Should I update the CLI path to my npm directory? If the docs suggest no issues when no react-native CLI is installed, why do I need to install it for pod install
to work?
Environment:
MacOS 10.15
node 12.14.1
ruby ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19] (attempted with rbenv 2.5)
xcode-select version 2373.