Fail to add plugin with prerelease version because of "Invalid Version"
- Dominant language
- JavaScript
- Stars
- 231
- Forks
- 242
- Avg merge
- 2h 51m
- Merged PRs (30d)
- 7
Description
# Bug Report
## Problem
### What is expected to happen?
_Basic_ `cordova plugin add ` 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 `@` 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 install`s 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
- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above
Contributor guide
Research direction
Reproduce the issue with the listed `cordova plugin add` commands in the cordova-lib plugin-add flow, comparing prerelease and release versions. Trace how the package version is resolved and confirm that prerelease plugins install without an explicit version while the existing release behavior remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100