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

Cannot install Pods when init App #766

Closed
lysenkoo opened this issue Oct 3, 2019 · 8 comments
Closed

Cannot install Pods when init App #766

lysenkoo opened this issue Oct 3, 2019 · 8 comments

Comments

@lysenkoo
Copy link

lysenkoo commented Oct 3, 2019

Environment

System:
OS: macOS High Sierra 10.13.6
CPU: (4) x64 Intel(R) Core(TM) i5-2557M CPU @ 1.70GHz
Memory: 24.54 MB / 4.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.10.0 - /usr/local/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.11.3 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
Android SDK:
API Levels: 22, 23, 25, 26, 27, 28
Build Tools: 23.0.1, 26.0.1, 26.0.2, 27.0.3, 28.0.3
System Images: android-26 | Google APIs Intel x86 Atom_64
IDEs:
Android Studio: 3.3 AI-182.5107.16.33.5264788
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.2 => 0.61.2
npmGlobalPackages:
create-react-native-app: 1.0.0
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7

Description

When i run command

npx react-native init MyApp
Process ended with error:

Info All dependencies
├─ @babel/core@7.6.2
├─ @babel/runtime@7.6.2
├─ @react-native-community/eslint-config@0.0.5
├─ @types/eslint-visitor-keys@1.0.0
├─ @types/json-schema@7.0.3
├─ @typescript-eslint/eslint-plugin@1.13.0
├─ @typescript-eslint/parser@1.13.0
├─ acorn-jsx@5.0.2
├─ acorn@7.1.0
├─ ajv@6.10.2
├─ babel-jest@24.9.0
├─ chardet@0.7.0
├─ doctrine@3.0.0
├─ eslint-scope@5.0.0
├─ eslint-utils@1.4.2
├─ eslint@6.5.1
├─ espree@6.1.1
├─ esquery@1.0.1
├─ external-editor@3.1.0
├─ file-entry-cache@5.0.1
├─ flat-cache@2.0.1
├─ flatted@2.0.1
├─ glob-parent@5.1.0
├─ ignore@4.0.6
├─ import-fresh@3.1.0
├─ inquirer@6.5.2
├─ is-extglob@2.1.1
├─ is-glob@4.0.1
├─ jest@24.9.0
├─ json-stable-stringify-without-jsonify@1.0.1
├─ levn@0.3.0
├─ lodash.unescape@4.0.1
├─ metro-react-native-babel-preset@0.56.0
├─ optionator@0.8.2
├─ parent-module@1.0.1
├─ progress@2.0.3
├─ react-test-renderer@16.9.0
├─ rxjs@6.5.3
├─ strip-json-comments@3.0.1
├─ table@5.4.6
├─ text-table@0.2.0
├─ tslib@1.10.0
├─ tsutils@3.17.1
├─ v8-compile-cache@2.1.0
└─ write@1.0.3
✨  Done in 24.13s.
info Installing required CocoaPods dependencies

[!] Invalid `Podfile` file: cannot infer basepath.

 #  from /works/MyApp/ios/Podfile:2
 #  -------------------------------------------
 #  platform :ios, '9.0'
 >  require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
 #
 #  -------------------------------------------

(node:33132) UnhandledPromiseRejectionWarning: Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template.
Please try again manually: "cd ./MyApp/ios && pod install".
CocoaPods documentation: https://cocoapods.org/
    at installPods (/works/MyApp/node_modules/@react-native-community/cli/build/tools/installPods.js:157:13)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:33132) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:33132) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

In ../node_modules/@react-native-community/cli-platform-ios/ i cannot find directory native_modules

pod --version
1.8.1

Reproducible Demo

It's reproduce on my PC

@grabbou
Copy link
Member

grabbou commented Oct 10, 2019

Are you using Yarn workspaces? Can you verify that node_modules/@react-native-community/cli-platform-ios is a valid path?

Looks like either something is missing in your node_modules or you're using a monorepo and packages were hoisted.

Also, have you tried running:

Please try again manually: "cd ./MyApp/ios && pod install".

as per the debugging info?

@lysenkoo
Copy link
Author

@grabbou

Are you using Yarn workspaces?

How i can check this?

node_modules/@react-native-community/cli-platform-ios is a valid path?

I think yes, because i see this path and files:
LICENSE build native_modules.rb package.json

you're using a monorepo and packages were hoisted.

How i can check this?

Also, have you tried running:
Please try again manually: "cd ./MyApp/ios && pod install".

MacBook-Air:tests admin$ cd ./MyApp/ios && pod install --verbose

[!] Invalid `Podfile` file: cannot infer basepath.

 #  from /works/tests/MyApp/ios/Podfile:2
 #  -------------------------------------------
 #  platform :ios, '9.0'
 >  require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
 #
 #  -------------------------------------------

/Users/admin/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/cocoapods-core-1.8.1/lib/cocoapods-core/podfile.rb:301:in `rescue in block in from_ruby'
/Users/admin/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/cocoapods-core-1.8.1/lib/cocoapods-core/podfile.rb:295:in `block in from_ruby'
/Users/admin/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/cocoapods-core-1.8.1/lib/cocoapods-core/podfile.rb:50:in `instance_eval'
/Users/admin/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/cocoapods-core-1.8.1/lib/cocoapods-core/podfile.rb:50:in `initialize'
/Users/admin/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/cocoapods-core-1.8.1/lib/cocoapods-core/podfile.rb:293:in `new'
/Users/admin/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/cocoapods-core-1.8.1/lib/cocoapods-core/podfile.rb:293:in `from_ruby'
/Users/admin/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/cocoapods-core-1.8.1/lib/cocoapods-core/podfile.rb:259:in `from_file'
/Users/admin/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/cocoapods-1.8.1/lib/cocoapods/config.rb:200:in `podfile'
/Users/admin/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/cocoapods-1.8.1/lib/cocoapods/command.rb:150:in `verify_podfile_exists!'
/Users/admin/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/cocoapods-1.8.1/lib/cocoapods/command/install.rb:46:in `run'
/Users/admin/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
/Users/admin/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/cocoapods-1.8.1/lib/cocoapods/command.rb:52:in `run'
/Users/admin/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/cocoapods-1.8.1/bin/pod:55:in `<top (required)>'
/Users/admin/.rbenv/versions/2.1.0/bin/pod:23:in `load'
/Users/admin/.rbenv/versions/2.1.0/bin/pod:23:in `<main>'
MacBook-Air:ios admin$

I think problem that Pod cannot find pods in cli-platform-ios/native_modules But i don't know Pods(native iOS libs ) are already builded in repo, or i need run build step for Pods. If second, so how i can run this step?

@FernandoHT
Copy link

update gem xcodeproj gem
#487 (comment)

@thymikee
Copy link
Member

Please update the @react-native-community/cli to the latest version.

@lysenkoo
Copy link
Author

update gem xcodeproj gem
#487 (comment)

Sorry, but it's not my situation.

MacBook-Air:iOS admin$ gem update xcodeproj
Updating installed gems
Nothing to update

Please update the @react-native-community/cli to the latest version.

with └─ @react-native-community/cli@3.0.0-alpha.7 same error.

MacBook-Air:MyApp admin$ cd iOS
MacBook-Air:iOS admin$ pod install

[!] Invalid `Podfile` file: cannot infer basepath.

 #  from /works/Tests/test2/MyApp/ios/Podfile:2
 #  -------------------------------------------
 #  platform :ios, '9.0'
 >  require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
 #
 #  -------------------------------------------

@thymikee
Copy link
Member

Thanks. Can you setup a minimal repro which we could investigate?

@thymikee thymikee reopened this Oct 16, 2019
@lysenkoo
Copy link
Author

@thymikee Hi!
I remove "global" cache (in home dir ) for all components: npm, yarn, cocoapod. In other words i leave only binaries, than i upgrade all binaries - brew, cocoapod, npm etc.

And now i can init RN app 0.61, with cli 3.0-alpha without errors.

Thank you.

@patgoley
Copy link

patgoley commented Nov 5, 2019

I got this same error and the problem was the version of Ruby I was using when running pod install. I had been using Ruby v2.1.0 (same as issue author above). Upgrading to Ruby v2.4.1 fixed the issue (require_relative was not supported in eval'd files in 2.1.0).

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

5 participants