cordova-plugin-screen-orientation: `Failed to install 'cordova-plugin-screen-orientation': Error: Expected plugin to have ID "es6-promise-plugin" but got "cordova-plugin-screen-orientation".`on `cordova prepare android`

Bug Report

Problem

Since 3.0.2 cordova prepare android leads to this error (at least for us):

Installing "cordova-plugin-screen-orientation" for android
Failed to install 'cordova-plugin-screen-orientation': Error: Expected plugin to have ID "es6-promise-plugin" but got "cordova-plugin-screen-orientation".
    at checkID (/home/circleci/.config/yarn/global/node_modules/cordova-lib/src/plugman/fetch.js:203:15)
    at /home/circleci/.config/yarn/global/node_modules/cordova-lib/src/plugman/fetch.js:187:9
    at _fulfilled (/home/circleci/.config/yarn/global/node_modules/q/q.js:854:54)
    at /home/circleci/.config/yarn/global/node_modules/q/q.js:883:30
    at Promise.promise.promiseDispatch (/home/circleci/.config/yarn/global/node_modules/q/q.js:816:13)
    at /home/circleci/.config/yarn/global/node_modules/q/q.js:624:44
    at runSingle (/home/circleci/.config/yarn/global/node_modules/q/q.js:137:13)
    at flush (/home/circleci/.config/yarn/global/node_modules/q/q.js:125:13)
    at process._tickCallback (internal/process/next_tick.js:61:11)
Failed to restore plugin "cordova-plugin-screen-orientation" from config.xml. You might need to try adding it again. Error: Error: Expected plugin to have ID "es6-promise-plugin" but got "cordova-plugin-screen-orientation".

Setting the version to 3.0.1 fixes the problem for us.

What is expected to happen?

cordova prepare android / plugin installation works without errors.

What does actually happen?

The error above.

Command or Code

cordova prepare android

Environment, Platform, Device

Android, built on CircleCI

Version information

cordova-android@7.1.1 cordova-plugin-screen-orientation@^3.0.1

Checklist

  • I searched for existing GitHub issues
  • I included all the necessary information above
  • I updated all Cordova tooling to most recent version -> we did not yet upgrade to cordova-android@8.0.0

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 16 (8 by maintainers)

Most upvoted comments

This works for me: npm i es6-promise-plugin

Thanks @Stephane84, that is really strange. But at least we know it is not caused by the new version. What CLI version are you using?

cordova CLI 8.0.0

node 6.9.5 npm 5.6.0 ionic CLI 3.20.0

I had a similar issue today, but not with same version. cordova-android@6.4.0 cordova-plugin-screen-orientation 3.0.1 (not 3.0.2) cordova CLI 8.0.0

i obtain the same stack for ‘cordova prepare android’ during plugin research :

Installing "cordova-plugin-screen-orientation" for android
Failed to install 'cordova-plugin-screen-orientation': Error: Expected plugin to have ID "es6-promise-plugin" but got "cordova-plugin-screen-orientation".
    at checkID (C:\Dev\tools\npm\node_modules\cordova\node_modules\cordova-lib\src\plugman\fetch.js:215:15)
    at C:\Dev\tools\npm\node_modules\cordova\node_modules\cordova-lib\src\plugman\fetch.js:199:9
    at _fulfilled (C:\Dev\tools\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\q\q.js:787:54)
    at self.promiseDispatch.done (C:\Dev\tools\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\q\q.js:816:30)
    at Promise.promise.promiseDispatch (C:\Dev\tools\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\q\q.js:749:13)
    at C:\Dev\tools\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\q\q.js:557:44
    at flush (C:\Dev\tools\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\q\q.js:108:17)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)
Failed to restore plugin "cordova-plugin-screen-orientation" from config.xml. You might need to try adding it again. Error: Error: Expected plugin to have ID "es6-promise-plugin" but got "cordova-plugin-screen-orientation".

changing to cordova-plugin-screen-orientation 3.0.2 solve the problem. Strange…

(I renamed the issue to reflect the problem better - this way we can keep it open and investigate further.)