This is because we are comparing pkgJson.cordova.platforms which is an array of non-prefixed cordova platforms, and then we are comparing those values against dependencies or devDependencies which is always going to be a cordova- prefixed platform. This compatibility will always result in an undefined spec.
This issue is described more in depth in this thread.
Command or Code
Environment, Platform, Device
Version information
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
Bug Report
Problem
Code:
https://github.com/apache/cordova-lib/blob/dd872f044211592b11c17d23d56cd17192e4b51f/src/cordova/restore-util.js#L99-L112
What is expected to happen?
This should be able to find the spec version
What does actually happen?
spec will always result in
undefined
Information
This is because we are comparing
pkgJson.cordova.platforms
which is an array of non-prefixed cordova platforms, and then we are comparing those values againstdependencies
ordevDependencies
which is always going to be acordova-
prefixed platform. This compatibility will always result in an undefined spec.This issue is described more in depth in this thread.
Command or Code
Environment, Platform, Device
Version information
Checklist