I have been flowing along with the initial steps for getting started with React Native over on FB's git page. https://facebook.github.io/react-native/docs/getting-started
During the process, using nxp or npm installed CLI, I get the flowing 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 happens during the cocoapods installation. The docs say:
If you previously installed a global react-native-cli package, please remove it as it may cause unexpected issues.
But this happens no matter what's installed or what is used to create the starting files.
In the Podfile there are these lines:
platform :ios, '13.0' # <- this was 9.0 but I changed to 13.0
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
If I do an npm install @react-native-commuinty/cli locally within the project and then do the pod install
everything works out correctly. Should I change the CLI path to that of my npm directory? If the docs say that it shouldn't have any problems when no react-native CLI is installed then why would I need to install it to make the pod install
work?
Environment:
MacOS 10.15
node 12.14.1
ruby ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19] (tried with rbenv 2.5)
xcode-select version 2373.
it needs to be local. As you enter
npx react-native init [project name]
it will add it locally.
https://facebook.github.io/react-native/docs/getting-started
this official link advices:
If you previously installed a global react-native-cli package, please remove it as it may cause unexpected issues.