Capacitor: `create` command fails if cocoapods is not available

Created on 19 Apr 2018  ·  8Comments  ·  Source: ionic-team/capacitor

If creating a project on macOS (npx @capacitor/cli create), it expects the user to have cocoapods installed. If this is only a requirement if the user is developing for the web, then this should be optional and not fail.

⚡️   Welcome to Capacitor (CLI v1.0.0-alpha.35) ⚡️

✔ Creating app cap-test in xxxxxx-capacitor-test with id com.xxxxxx.cap in 22.17ms
✔ Installing dependencies in 24.70s
✔ Installing iOS dependencies in 9.24s
✔ Adding native xcode project in: /Users/xxxxxxxxxx/Repositories/xxxxxx-capacitor-test/ios in 44.29ms
✔ Copying web assets from www to ios/App/public in 8.84ms
✔ Copying native bridge in 1.60ms
✔ Copying capacitor.config.json in 2.82ms
✔ copy in 28.07ms
✔ Updating iOS plugins in 1.67ms
  Found 0 Capacitor plugins for ios:
✖ Updating iOS native dependencies: 
✖ update ios: 
✖ add default platforms: 
Usage: npx @capacitor/cli create appDir appName appId
Example: npx @capacitor/cli create my-app "My App" "com.example.myapp"
[error] /bin/sh: /usr/local/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby: bad interpreter: No such file or directory

Most helpful comment

I was having issue with "npx cap add ios" for ionic.
Error was:
[error] /bin/sh: /usr/local/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby: bad interpreter: No such file or directory

Fix was
sudo gem install -n /usr/local/bin cocoapods

just putting it out there for people who are having trouble.

versions:

All 8 comments

create creates a project with android and ios included, while init just adds capacitor to an existing project but it doesn't include any native platform.

@mlynch, Should we change create to not add platforms?

having the same issue. Any solution?

Which version are you using? create command no longer adds platforms, so shouldn't be a problem

I was having issue with "npx cap add ios" for ionic.
Error was:
[error] /bin/sh: /usr/local/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby: bad interpreter: No such file or directory

Fix was
sudo gem install -n /usr/local/bin cocoapods

just putting it out there for people who are having trouble.

versions:

Then it's not the same problem 😉

CocoaPods is a requirement, but maybe we should have better error messaging when it's not installed

It was giving the same problem when I was doing "npx @capacitor/cli create"
However, it is fixed now. I hope my solution will help others :)
Thank you for fast response!

thank you @etonyali . solved this problem

@etonyali
I am getting the below error message:

Traceback (most recent call last):
5: from /usr/local/bin/pod:23:in <main>' 4: from /usr/local/bin/pod:23:inload'
3: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/bin/pod:55:in <top (required)>' 2: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/command.rb:49:inrun'
1: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/command.rb:130:in verify_minimum_git_version!' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/command.rb:118:ingit_version': Failed to extract git version from git --version ("xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun\n") (RuntimeError)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

json-derulo picture json-derulo  ·  3Comments

Hansel03 picture Hansel03  ·  3Comments

nicobytes picture nicobytes  ·  3Comments

MatanYadaev picture MatanYadaev  ·  3Comments

stripathix picture stripathix  ·  3Comments