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

Fail to add plugin with prerelease version because of "Invalid Version" #867

Open
3 tasks done
ath0mas opened this issue Feb 20, 2021 · 1 comment
Open
3 tasks done

Comments

@ath0mas
Copy link
Contributor

ath0mas commented Feb 20, 2021

Bug Report

Problem

What is expected to happen?

Basic cordova plugin add <plugin-name> of a plugin published on NPM with prerelease version should install without error.

What does actually happen?

Fail to add plugin because of Invalid Version: null.

Information

It works fine forcing @<exact-version> spec, or for same kind of plugin but with a release version.

Command or Code

$ cordova plugin add cordova-plugin-ns0m-media-capture
Invalid Version: null
$ cordova plugin add cordova-plugin-ns0m-file-transfer
Invalid Version: null

$ cordova plugin add cordova-plugin-ns0m-disk-space
Adding cordova-plugin-ns0m-disk-space to package.json

while npm installs are running fine, fetching 3.0.4-3, 2.0.0-2, and 1.1.0 respectively,
and same for

$ cordova plugin add cordova-plugin-ns0m-media-capture@3.0.4-3
Adding cordova-plugin-ns0m-media-capture to package.json
$ cordova plugin add cordova-plugin-ns0m-file-transfer@2.0.0-2
Adding cordova-plugin-ns0m-file-transfer to package.json

$ cordova plugin add cordova-plugin-ns0m-disk-space@1.1.0
Adding cordova-plugin-ns0m-disk-space to package.json

Environment, Platform, Device

Windows 10, Node 14 & 15, NPM 6 & 7

Version information

Cordova Packages:

    cli: 10.0.0
        common: 4.0.2
        create: 3.0.0
        lib: 10.0.0
            common: 4.0.2
            fetch: 3.0.1
            serve: 4.0.0

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above
@ath0mas ath0mas changed the title Fail to add plugin with prelease version because of "Invalid Version" Fail to add plugin with prerelease version because of "Invalid Version" Feb 20, 2021
@ath0mas
Copy link
Contributor Author

ath0mas commented Feb 20, 2021

Seems to be during cordovaDependencies resolution where latest is null (given // Filters out pre-release versions comment and that my published package only has prerelease versions).

See debug logs:

$ cordova plugin add cordova-plugin-ns0m-media-capture -d
No scripts found for hook "before_plugin_add".
No version specified for cordova-plugin-ns0m-media-capture, retrieving version from config.xml
No version for cordova-plugin-ns0m-media-capture saved in config.xml or package.json
Attempting to use npm info for cordova-plugin-ns0m-media-capture to choose a compatible release
Ignoring invalid version in cordova-plugin-ns0m-media-capture cordovaDependencies: >=1.4.4 (must be a single version <= latest or an upper bound)
Invalid Version: null
TypeError: Invalid Version: null
    at new SemVer (C:\Users\ath0mas\AppData\Roaming\npm\node_modules\cordova\node_modules\semver\classes\semver.js:19:13)
    at compare (C:\Users\ath0mas\AppData\Roaming\npm\node_modules\cordova\node_modules\semver\functions\compare.js:3:32)
    at Object.lte (C:\Users\ath0mas\AppData\Roaming\npm\node_modules\cordova\node_modules\semver\functions\lte.js:2:30)
    at Function.determinePluginVersionToFetch (C:\Users\ath0mas\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\plugin\add.js:387:59)
    at C:\Users\ath0mas\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\plugin\add.js:338:39
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
$ cordova plugin add cordova-plugin-ns0m-file-transfer -d
No scripts found for hook "before_plugin_add".
No version specified for cordova-plugin-ns0m-file-transfer, retrieving version from config.xml
No version for cordova-plugin-ns0m-file-transfer saved in config.xml or package.json
Attempting to use npm info for cordova-plugin-ns0m-file-transfer to choose a compatible release
Invalid Version: null
TypeError: Invalid Version: null
    at new SemVer (C:\Users\ath0mas\AppData\Roaming\npm\node_modules\cordova\node_modules\semver\classes\semver.js:19:13)
    at compare (C:\Users\ath0mas\AppData\Roaming\npm\node_modules\cordova\node_modules\semver\functions\compare.js:3:32)
    at Object.lte (C:\Users\ath0mas\AppData\Roaming\npm\node_modules\cordova\node_modules\semver\functions\lte.js:2:30)
    at Function.determinePluginVersionToFetch (C:\Users\ath0mas\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\plugin\add.js:387:59)
    at C:\Users\ath0mas\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\plugin\add.js:338:39
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
$ cordova plugin add cordova-plugin-ns0m-disk-space -d
No scripts found for hook "before_plugin_add".
No version specified for cordova-plugin-ns0m-disk-space, retrieving version from config.xml
No version for cordova-plugin-ns0m-disk-space saved in config.xml or package.json
Attempting to use npm info for cordova-plugin-ns0m-disk-space to choose a compatible release
npm info for cordova-plugin-ns0m-disk-space did not contain any engine info. Fetching latest release
Calling plugman.fetch on plugin "cordova-plugin-ns0m-disk-space"
fetch: Installing cordova-plugin-ns0m-disk-space to C:\Users\ath0mas\Desktop\hellocdv
Running command: npm install cordova-plugin-ns0m-disk-space --save-dev
Command finished with error code 0: npm install,cordova-plugin-ns0m-disk-space,--save-dev
Copying plugin "C:\Users\ath0mas\Desktop\hellocdv\node_modules\cordova-plugin-ns0m-disk-space" => "C:\Users\ath0mas\Desktop\hellocdv\plugins\cordova-plugin-ns0m-disk-space"
Adding cordova-plugin-ns0m-disk-space to package.json
No scripts found for hook "after_plugin_add".

vs.

$ cordova plugin add cordova-plugin-ns0m-media-capture@3.0.4-3 -d
No scripts found for hook "before_plugin_add".
Calling plugman.fetch on plugin "cordova-plugin-ns0m-media-capture@3.0.4-3"
fetch: Installing cordova-plugin-ns0m-media-capture@3.0.4-3 to C:\Users\ath0mas\Desktop\hellocdv
Running command: npm install cordova-plugin-ns0m-media-capture@3.0.4-3 --save-dev
Command finished with error code 0: npm install,cordova-plugin-ns0m-media-capture@3.0.4-3,--save-dev
Copying plugin "C:\Users\ath0mas\Desktop\hellocdv\node_modules\cordova-plugin-ns0m-media-capture" => "C:\Users\ath0mas\Desktop\hellocdv\plugins\cordova-plugin-ns0m-media-capture"
Adding cordova-plugin-ns0m-media-capture to package.json
No scripts found for hook "after_plugin_add".
$ cordova plugin add cordova-plugin-ns0m-file-transfer@2.0.0-2 -d
No scripts found for hook "before_plugin_add".
Calling plugman.fetch on plugin "cordova-plugin-ns0m-file-transfer@2.0.0-2"
fetch: Installing cordova-plugin-ns0m-file-transfer@2.0.0-2 to C:\Users\ath0mas\Desktop\hellocdv
Running command: npm install cordova-plugin-ns0m-file-transfer@2.0.0-2 --save-dev
Command finished with error code 0: npm install,cordova-plugin-ns0m-file-transfer@2.0.0-2,--save-dev
Copying plugin "C:\Users\ath0mas\Desktop\hellocdv\node_modules\cordova-plugin-ns0m-file-transfer" => "C:\Users\ath0mas\Desktop\hellocdv\plugins\cordova-plugin-ns0m-file-transfer"
Adding cordova-plugin-ns0m-file-transfer to package.json
No scripts found for hook "after_plugin_add".
$ cordova plugin add cordova-plugin-ns0m-disk-space@1.1.0 -d
No scripts found for hook "before_plugin_add".
Calling plugman.fetch on plugin "cordova-plugin-ns0m-disk-space@1.1.0"
fetch: Installing cordova-plugin-ns0m-disk-space@1.1.0 to C:\Users\ath0mas\Desktop\hellocdv
Running command: npm install cordova-plugin-ns0m-disk-space@1.1.0 --save-dev
Command finished with error code 0: npm install,cordova-plugin-ns0m-disk-space@1.1.0,--save-dev
Copying plugin "C:\Users\ath0mas\Desktop\hellocdv\node_modules\cordova-plugin-ns0m-disk-space" => "C:\Users\ath0mas\Desktop\hellocdv\plugins\cordova-plugin-ns0m-disk-space"
Adding cordova-plugin-ns0m-disk-space to package.json
No scripts found for hook "after_plugin_add".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant