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

Pod install fails with non-error message for fresh installations #3686

Closed
surdu opened this issue Jun 15, 2018 · 13 comments
Closed

Pod install fails with non-error message for fresh installations #3686

surdu opened this issue Jun 15, 2018 · 13 comments
Assignees
Milestone

Comments

@surdu
Copy link

surdu commented Jun 15, 2018

I first noticed the problem on CI when trying to prepare an iOS project on a new machine, but in order to exclude being a problem with the CI itself I managed to find a way to reproduce it also on my local machine:

  1. (Re)Move CocoaPods local caches:
    mv ~/.cocoapods ~/.cocoapods.bkp
    mv ~/Library/Caches/CocoaPods ~/Library/Caches/CocoaPods.bkp
  2. Create new project:
    tns create Test
  3. Add a plugin that has Pods:
    tns plugin add nativescript-plugin-firebase
  4. Try preparing the project:
    tns prepare ios --log trace

This fails with the following error on my local machine, which looks like normal git output, not an error:

Pod install command failed. Error output:   Cloning into 'master'...
  remote: Counting objects: 2221781, done.        
  remote: Compressing objects: 100% (480/480), done.        
  remote: Total 2221781 (delta 237), reused 248 (delta 99), pack-reused 2221183        
  Receiving objects: 100% (2221781/2221781), 546.46 MiB | 7.19 MiB/s, done.
  Resolving deltas: 100% (1270873/1270873), done.
  Checking out files: 100% (245557/245557), done.

On our CI machine the error is more detailed, but still looks like normal git output.

Versions:

nativescript: 4.0.2
tns-ios: 4.0.1

$ pod --version
1.5.3
@surdu surdu changed the title Pod install fails with non-error message for new installations Pod install fails with non-error message for fresh installations Jun 16, 2018
@surdu
Copy link
Author

surdu commented Jun 21, 2018

I've just upgraded to the latest nativescript version and the problem persists 😢

@rosen-vladimirov, any ideas what I can try next ?

@surdu
Copy link
Author

surdu commented Sep 14, 2018

I've tested now on the newer NativeScript 4.2.3 version and the problem is still here 😞

nativescript: 4.2.3
tns-ios: 4.2.0
MacOS: Sierra v10.12.6 (16G1510)
XCode: 9.2 (9C40b)

$ pod --version
1.5.3

This is really blocking our CI efforts 😞

@vtjon
Copy link

vtjon commented Sep 17, 2018

I think this is happening to me too in my CI environment. I am using Bitrise and I don't get a detailed error message but I do get the Pod install command failed message. This is probably due to Bitrise dropping something in the message. I can build locally. @surdu - have you had any luck on fixing this?

@surdu
Copy link
Author

surdu commented Sep 17, 2018

@vtjon Nope!

@vtjon
Copy link

vtjon commented Sep 18, 2018

I think I narrowed down what is going on with my environment. I have nstudio/camera-plus and the nativescript-imagepicker in my project. I get a couple of warnings that appear to crash the prepare process. The pertinent part is:

Pod installation complete! There are 17 dependencies from the Podfile and 26 total pods installed.
[WARNING]: /usr/local/lib/ruby/gems/2.5.0/gems/nokogiri-1.6.8.1/lib/nokogiri/xml/document.rb:44: warning: constant ::Fixnum is deprecated
[WARNING]: [!] Smart quotes were detected and ignored in your Podfile. To avoid issues in the future, you should not use TextEdit for editing it. If you are not using TextEdit, you should turn off smart quotes in your editor of choice.
[WARNING]: [!] There are duplicate dependencies on `QBImagePickerController` in `Podfile`:
Pod install command failed. Error output: 
 QBImagePickerController
- QBImagePickerController (~> 3.4.0)

I am not sure if this should be a fatal error or not.

@rosen-vladimirov
Copy link
Contributor

Hey guys,
We have reproduced the issue and it seems Cocoapods print warnings that CLI detects as errors. May I ask you to try the following fix:

  1. Find where your CLI is installed (which tns should help you).
  2. Locate the <nativescript installation dir>/lib/services/ios-project-service.js file and open it.
  3. Find the executePodInstall method and change this line:
const childProcess = yield this.$childProcess.spawnFromEvent(podTool, ["install"], "close", { cwd: this.getPlatformData(projectData).projectRoot, stdio: ['pipe', process.stdout, 'pipe'] });

to:

const childProcess = yield this.$childProcess.spawnFromEvent(podTool, ["install"], "close", { cwd: this.getPlatformData(projectData).projectRoot, stdio: ['pipe', process.stdout, 'pipe'] }, { throwError: false });

This should trigger special logic in CLI to try parsing the data from stderr of pod install command and it could resolve your issue.

Can you please give it a try and inform us if it resolves your issue?

@vtjon
Copy link

vtjon commented Sep 19, 2018

@rosen-vladimirov I am not going to be able to try this solution at this time as it was only happening in my cloud CI environment (bitrise) and I managed the clear the warnings so I could finally build. Thanks for your response though. Hopefully surdu can try.

@surdu
Copy link
Author

surdu commented Sep 19, 2018

@rosen-vladimirov Tried it on my local machine and doesn't appear to fix the issue, as finally I still get:

Pod installation complete! There are 12 dependencies from the Podfile and 24 total pods installed.

Unable to apply changes on device: 50CA1550-791F-4C50-A1FA-619D5A40D917. Error is: Pod install command failed. Error output:   Cl
oning into 'master'...
  remote: Counting objects: 2444211, done.
  remote: Compressing objects: 100% (429/429), done.
  remote: Total 2444211 (delta 178), reused 35 (delta 35), pack-reused 2443732
  Receiving objects: 100% (2444211/2444211), 572.19 MiB | 4.18 MiB/s, done.
  Resolving deltas: 100% (1421309/1421309), done.
  Checking out files: 100% (267832/267832), done.
.

Here is another interesting part when using --log trace:

Pod installation complete! There are 12 dependencies from the Podfile and 24 total pods installed.
Result when throw error is false:
{ stdout: '',
  stderr: '  Cloning into \'master\'...\n  remote: Counting objects: 2443732
  [...]
  Checking out files: 100% (267858/267858), done.\n',
  exitCode: 0 
}

Shouldn't that cloning info message be in stdout not stderr ?

Complete log can be found here.

@rosen-vladimirov
Copy link
Contributor

Hey @surdu ,
Thanks for trying the fix. Yeah, these lines should be on stdout, but it looks like they are on stderr. You can try executing pod setup && pod repo update in your terminal, which should execute the failing git clone. After that you should be able to execute tns run ios for your project.

@surdu
Copy link
Author

surdu commented Sep 19, 2018

@rosen-vladimirov This solves the problem for my machine, but the one on the CI appears to still persist.

Here is the full output from the CI: https://pastebin.com/raw/rPD76Rgm

Please note that the pod setup and pod repo update where executed in a previous step not pressent in the above logs.

@rosen-vladimirov
Copy link
Contributor

Hey @surdu ,
It looks like your cocoapods repo is messed on the CI machine. Can you try executing:

$ rm -rf ~/.cocoapods/repos/master
$ pod setup
$ pod repo update

@surdu
Copy link
Author

surdu commented Sep 20, 2018

@rosen-vladimirov That doesn't seem to solve the issue :(

@surdu
Copy link
Author

surdu commented Sep 20, 2018

@rosen-vladimirov BUT the more drastic measure of deleting the whole ~/.cocoapods and ~/Library/Caches/CocoaPods did fix it 🎉

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