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

Cordova not allowing beta versions of plugins to run, instead requiring full version numbers. #165

Closed
3 tasks done
mattmilan-dev opened this issue Oct 16, 2019 · 12 comments · Fixed by apache/cordova-ios#695
Labels
bug Something isn't working

Comments

@mattmilan-dev
Copy link

mattmilan-dev commented Oct 16, 2019

Bug Report

Problem

When running cordova run ios --device --verbose --target <IPHONE_TARGET> after updating to MacOS 10.15 Catalina, cordova now returns:

CordovaError: Promise rejected with non-error: 'Version should contain only numbers and dots'
    at cli.catch.err (/Users/devleaf.matt/.npm-global/lib/node_modules/cordova/bin/cordova:30:15)
    at process._tickCallback (internal/process/next_tick.js:68:7)

rather than going on to a successful IPA install and launch on my iPhone. After searching around it seems people have this problem with the google maps plugin, however I don't have this installed on my system. I have re-installed cordova, reinstalled cordova ios (platform removal and re-addition) and double checked my Cocoa pods version.

Information

2019-10-16 21 53 07

Screenshot 2019-10-16 at 22 12 54

Command or Code

cordova run ios --device --verbose --target <IPHONE_TARGET>

Environment, Platform, Device

VS Code | Ionic 4 | MacOS Catalina | iMac | iPhone 11 Pro

Version information

Cordova 8.1.2 (Lib 8.1.1)
XCode 11.1
Ionic 4 (CLI 5.4.4)

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above
@breautek
Copy link
Contributor

Version should contain only numbers and dots seems to suggest there is a version somewhere that probably has a label such as a pre-release e.g. 1.2.3-beta.1

Does any of your packages or plugins you have installed have a version format other than x.y.z format?

@mattmilan-dev
Copy link
Author

Hi Breautek, thanks for your quick response. I'll post below my plugin list in the config.xml, however I believe the problem to be the <plugin name="cordova-plugin-local-notification" spec="^0.9.0-beta.3" /> plugin. I'll downgrade to 0.9.0 but is it possible to keep this plugin in the current beta as some features between 0.9.0 and beta.3 are not available?

Screenshot 2019-10-18 at 18 55 02

@breautek breautek added the bug Something isn't working label Oct 18, 2019
@breautek
Copy link
Contributor

I'll mark this as a bug. I think cordova should support prerelease labels. They are perfectly valid in the semver spec.

Meanwhile, a workaround could be installing the plugin from the git repo, assuming it is hosted in a git repo. You can install the plugin from git. e.g;
cordova plugin add https://github.com/katzer/cordova-plugin-local-notifications.git#0.9-beta.3

Installing plugins from git should bypass semver version checks. Of course you lose out on automatic updating on minor/patch updates.

@mattmilan-dev mattmilan-dev changed the title cordova run: 'Cordova Error: Promise rejected with non-error: 'Version should contain only numbers and dots'' Cordova not allowing beta versions of plugins to run, instead requiring full version numbers. Oct 18, 2019
@mattmilan-dev
Copy link
Author

mattmilan-dev commented Oct 19, 2019

Hi breautek,

So i've tried adding the local notification plugin using the git repo rather than the conventional cordova add <plugin>@latest and it when running cordova plugin list i noticed it was still pulling 0.9.0-beta3 as it's name, unfortunately meaning there isn't a way to add the plugin without forking and changing the version number.

Quick edit: So i've forked the plugin and changed it's version number to 0.9.1 rather than 0.9.0-beta 3 but am still getting the error. Below is the cordova plugin list output.
Screenshot 2019-10-19 at 13 30 28

@breautek
Copy link
Contributor

breautek commented Oct 19, 2019 via email

@raphinesse
Copy link
Contributor

The error (that is not an Error 😉) originates in cordova-ios. That function should probably be updated to use semver to compare the versions. Unless there's a reason to only support a subset of semver.

The same code also seems to be copied to cordova-osx.

I think PRs to fix this issue would be very welcome. If someone creates them, please request a review from me since I'm not watching those platform repos.

@mattmilan-dev
Copy link
Author

The error (that is not an Error 😉) originates in cordova-ios. That function should probably be updated to use semver to compare the versions. Unless there's a reason to only support a subset of semver.

The same code also seems to be copied to cordova-osx.

I think PRs to fix this issue would be very welcome. If someone creates them, please request a review from me since I'm not watching those platform repos.

Hi Raphinesse,

I'm sorry it's not the best fix in the world, the semver spec is quite dynamic and has that many variants that it would take a while to process fully (unfortunately I don't have too much time on my hands) however this allows beta/alpha variants to work properly (or so it seems in my testing). Hope this helps someone in the future!

@adminy
Copy link

adminy commented Oct 21, 2019

I have nothing with beta versions but I am getting the same error.
Screenshot 2019-10-21 at 07 16 37

@mattmilan-dev
Copy link
Author

mattmilan-dev commented Oct 21, 2019

Hi adminy,

I noticed that a certain iOS plugin was running 1.10.0-beta3 even though no plugin I installed was of that version. To my knowledge (and I could be wrong), these plugins update near runtime in order to allow you to stay up to date so you won't know for sure. If you review my pull request above then modify that file in your local ios/osx setup then it will work as a temporary solution before I get the pull request submitted later today.

@adminy
Copy link

adminy commented Oct 21, 2019

Thank you @devleaf-matt your pull request worked, except it wasn't the bin/templates/scripts/cordova/lib/versions.js file that I had to modify, it was the platforms/ios/cordova/lib/versions.js file, but I assume this is generated from the template file at installation time or some other time when stetted up. Also in the throws it would be nice if there was a message saying which plugin's version did not pass, otherwise it's a non-informative throws. Thanks again and keep up the good work

@sanyashvets
Copy link

sanyashvets commented Oct 21, 2019

Hi. I'm faced with same error few days ago. But I have no beta or smth else in versions.
Also, this error occurs when I'm trying to run/build project with connected device (iOS 13.1.3, 12.4.3, 12.4.2)

CordovaError: Promise rejected with non-error: 'Version should contain only numbers and dots'
    at /Users/alex/.nvm/versions/node/v12.12.0/lib/node_modules/cordova/bin/cordova:29:15
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
[ERROR] An error occurred while running subprocess cordova.
        
        cordova build ios --device exited with exit code 1.
        
        Re-running this command with the --verbose flag may provide more information.


 ionic cordova plugin list
> cordova plugin ls
cordova-plugin-advanced-http 2.2.0 "Advanced HTTP plugin"
cordova-plugin-camera 4.1.0 "Camera"
cordova-plugin-camera-preview 0.11.0 "cordova-plugin-camera-preview"
cordova-plugin-device 2.0.3 "Device"
cordova-plugin-file 6.0.2 "File"
cordova-plugin-insomnia 4.3.0 "Insomnia (prevent screen sleep)"
cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 4.1.2 "cordova-plugin-ionic-webview"
cordova-plugin-nativestorage 2.3.2 "NativeStorage"
cordova-plugin-network-information 2.0.2 "Network Information"
cordova-plugin-screen-orientation 3.0.2 "Screen Orientation"
cordova-plugin-splashscreen 5.0.3 "Splashscreen"
cordova-plugin-statusbar 2.4.3 "StatusBar"
cordova-plugin-whitelist 1.3.4 "Whitelist"
es6-promise-plugin 4.2.2 "Promise"
phonegap-plugin-barcodescanner 8.1.0 "BarcodeScanner"

Environment, Platform, Device
WebStorm / native terminal (both /bin/zsh and /bin/bash) | Ionic 4 | MacOS Catalina | iPhone 11 Pro | iPhone 6S, Ipad 3rd-gen

Version information
Cordova 9.0.9
XCode Version 11.1 (11A1027)
Ionic 4 (CLI 5.4.4)

@adminy
Copy link

adminy commented Oct 21, 2019

@sanyashvets Just do what I did

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants