Apple-osx engine version undefined when installing plugin
I've a plugin which defines engine apple-osx
<engine name="apple-osx" version=">=10.14.0" />
but when installing such plugin for 2 platforms (iOS and OSX) I receive following error
Failed to install 'cordova-plugin-local-notification': TypeError: Invalid Version: undefined
at new SemVer (/Users/tomec/.nvm/versions/node/v10.8.0/lib/node_modules/cordova/node_modules/semver/semver.js:305:11)
at Range.test (/Users/tomec/.nvm/versions/node/v10.8.0/lib/node_modules/cordova/node_modules/semver/semver.js:1112:15)
at Function.satisfies (/Users/tomec/.nvm/versions/node/v10.8.0/lib/node_modules/cordova/node_modules/semver/semver.js:1161:16)
at checkEngines (/Users/tomec/.nvm/versions/node/v10.8.0/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:116:20)
at /Users/tomec/.nvm/versions/node/v10.8.0/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:313:16
at _fulfilled (/Users/tomec/.nvm/versions/node/v10.8.0/lib/node_modules/cordova/node_modules/q/q.js:854:54)
at /Users/tomec/.nvm/versions/node/v10.8.0/lib/node_modules/cordova/node_modules/q/q.js:883:30
at Promise.promise.promiseDispatch (/Users/tomec/.nvm/versions/node/v10.8.0/lib/node_modules/cordova/node_modules/q/q.js:816:13)
at /Users/tomec/.nvm/versions/node/v10.8.0/lib/node_modules/cordova/node_modules/q/q.js:624:44
at runSingle (/Users/tomec/.nvm/versions/node/v10.8.0/lib/node_modules/cordova/node_modules/q/q.js:137:13)
Error is due to currentVersion: 'undefined' in parsed engine
{
platform: 'ios',
scriptSrc: '/Users/tomec/Projects/CordovaTest/platforms/ios/cordova/apple_osx_version',
minVersion: '>=10.14.0',
currentVersion: 'undefined',
name: 'apple-osx'
}
I've located problem down to script lib/versions.js which is called from script apple_osx_version. The problem is due to invalid RegEx var regexOSX = /^OS X \d+/; because now the output from xcodebuild -showsdks looks following:
macOS SDKs:
macOS 10.14 -sdk macosx10.14
Changing RegEx to var regexOSX = /^macOS \d+/;fixed the problem.
Node version: v10.8.0 Cordova version: 8.1.1
Could you please provide a link to the file you are talking about. Or even better, create a Pull Request with the fix in the respective repository?