CHECKLIST
[x] I confirm this is a suspected bug or issue that will affect other users
[ ] I have reproduced the issue using the example project or provided the necessary information to reproduce the issue.
[x] I have read the documentation thoroughly and it does not help solve my issue.
[x] I have checked that no similar issues (open or closed) already exist.
Current behavior:
On travis CI, when using image xcode11.5 which comes with CocoaPods v1.9.2, when running
ionic cordova platform add ios
prints the following at some point :
Failed to install 'cordova-plugin-firebasex': Error: cocoapods version is invalid - please reinstall cocoapods@^1.9.0: Resolving dependencies...
1.9.2
at checkCocoapodsVersion (/Users/travis/build/Alpha-health/perspectives-app/plugins/cordova-plugin-firebasex/scripts/ios/before_plugin_install.js:19:15)
at module.exports (/Users/travis/build/Alpha-health/perspectives-app/plugins/cordova-plugin-firebasex/scripts/ios/before_plugin_install.js:7:5)
at runScriptViaModuleLoader (/Users/travis/.nvm/versions/node/v12.14.1/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:181:32)
at runScript (/Users/travis/.nvm/versions/node/v12.14.1/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:157:16)
at /Users/travis/.nvm/versions/node/v12.14.1/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:125:20
at processTicksAndRejections (internal/process/task_queues.js:94:5)
Failed to restore plugin "cordova-plugin-firebasex" from config.xml. You might need to try adding it again. Error: Error: cocoapods version is invalid - please reinstall cocoapods@^1.9.0: Resolving dependencies...
1.9.2
cordova-plugin-firebasex: Preparing Firebase on iOS
[ERROR] An error occurred while running subprocess cordova.
cordova platform add [email protected] exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
In spite of this error, though, the build carries on.
Expected behavior:
The plugin should be installed properly as 1.9.2 complies with ^1.9.0.
Steps to reproduce:
Not 100% sure if this is related to Cocoapods version or the Travis environment.
In there, running
pod --version
prints out
Resolving dependencies...
1.9.2
Screenshots


Environment information
cordova -vcordova platform lscordova plugin lssw_verswinver_Runtime issue_
_iOS build issue:_
Build language: objective-c
Build id: 175871121
Job id: 361678322
Runtime kernel version: 19.4.0
travis-build version: 01e86bea
Build image provisioning date and time
Tue May 26 19:33:34 GMT 2020
Operating System Details
ProductName: Mac OS X
ProductVersion: 10.15.4
BuildVersion: 19E287
Git version
git version 2.26.2
bash version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin19)
Copyright (C) 2007 Free Software Foundation, Inc.
GCC version
Apple clang version 11.0.3 (clang-1103.0.32.62)
Target: x86_64-apple-darwin19.4.0
Thread model: posix
InstalledDir: /Applications/Xcode-11.5.GM.Seed.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
LLVM version
Apple clang version 11.0.3 (clang-1103.0.32.62)
Target: x86_64-apple-darwin19.4.0
Thread model: posix
InstalledDir: /Applications/Xcode-11.5.GM.Seed.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Pre-installed Ruby versions
ruby-2.6.6
Pre-installed Node.js versions
v10.20.1
v12.16.3
v12.17.0
v13.14.0
v14.3.0
v4.9.1
v6.17.1
v8.17.0
mvn -version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /usr/local/Cellar/maven/3.6.3_1/libexec
Java version: 13.0.2, vendor: N/A, runtime: /usr/local/Cellar/openjdk/13.0.2+8_2/libexec/openjdk.jdk/Contents/Home
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.15.4", arch: "x86_64", family: "mac"
Other information:
I believe the install fails because of the code in
That code expects the output of pod --version to be a single-line string with a version number (which seems like a valid assumption) , but it therefore fails to parse this multiline string
Resolving dependencies...
1.9.2
One option might be to be a bit more laxist, and expect the version number to be on the last line of the stdout, and just validate that part.
Update : I could also reproduce it on a different Travis image (XCode12) which comes with Cocoapods v1.9.3 (the latest I believe)
pod --version
also prints
Resolving dependencies...
1.9.3
and therefore the build shows the same message :
Failed to install 'cordova-plugin-firebasex': Error: cocoapods version is invalid - please reinstall cocoapods@^1.9.0: Resolving dependencies...
1.9.3
at checkCocoapodsVersion (/Users/travis/build/Alpha-health/perspectives-app/plugins/cordova-plugin-firebasex/scripts/ios/before_plugin_install.js:19:15)
at module.exports (/Users/travis/build/Alpha-health/perspectives-app/plugins/cordova-plugin-firebasex/scripts/ios/before_plugin_install.js:7:5)
at runScriptViaModuleLoader (/Users/travis/.nvm/versions/node/v12.14.1/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:181:32)
at runScript (/Users/travis/.nvm/versions/node/v12.14.1/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:157:16)
at /Users/travis/.nvm/versions/node/v12.14.1/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:125:20
at processTicksAndRejections (internal/process/task_queues.js:94:5)
Failed to restore plugin "cordova-plugin-firebasex" from config.xml. You might need to try adding it again. Error: Error: cocoapods version is invalid - please reinstall cocoapods@^1.9.0: Resolving dependencies...
1.9.3
cordova-plugin-firebasex: Preparing Firebase on iOS
[ERROR] An error occurred while running subprocess cordova.
cordova platform add [email protected] exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
Maybe the best approach is to use a regex to extract the version number from the stdout before comparing it with semver:
/\d+\.\d+\.\d+/
Most helpful comment
Maybe the best approach is to use a regex to extract the version number from the stdout before comparing it with
semver:/\d+\.\d+\.\d+/