Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-12918

Inconsistent behavior between "cordova prepare" and "cordova plugin add" when installing plugin from local folder

Agile BoardAttach filesAttach ScreenshotAdd voteVotersWatch issueWatchersLinkUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Reopened
    • Major
    • Resolution: Unresolved
    • 7.0.1
    • None
    • cordova-cli

    Description

      Running "cordova prepare" and "cordova plugin add" handle plugin installation from a local folder differently and either one or another breaks depending on which one used first.
      For example, I have a plugin defined as following in the config.xml:

      <widget ...>
        ...  
        <plugin name="cordova-plugin-ios-no-export-compliance" spec="./custom_plugins/cordova-plugin-ios-no-export-compliance" />
        ...
      </widget>
      

      This config is created when I run "cordova plugin add ./custom_plugins/cordova-plugin-ios-no-export-compliance" and everything works as expected. But, if you delete the plugin from the plugins folder and try to run "cordova prepare" afterwards it will fail with the following message:

      Discovered plugin "cordova-plugin-ios-no-export-compliance" in config.xml. Adding it to the project
      Failed to restore plugin "cordova-plugin-ios-no-export-compliance" from config.xml. You might need to try adding it again. Error: Failed to fetch plugin cordova-plugin-ios-no-export-compliance@file:custom_plugins/cordova-plugin-ios-no-export-compliance via registry.
      Probably this is either a connection problem, or plugin spec is incorrect.
      Check your connection and plugin name/version/URL.
      Error: npm: Command failed with exit code 254 Error output:
      npm ERR! addLocal Could not install [project path]/node_modules/custom_plugins/cordova-plugin-ios-no-export-compliance
      npm ERR! path [project path]/node_modules/custom_plugins/cordova-plugin-ios-no-export-compliance
      npm ERR! code ENOENT
      npm ERR! errno -2
      npm ERR! syscall open
      npm ERR! enoent ENOENT: no such file or directory, open '[project path]/node_modules/custom_plugins/cordova-plugin-ios-no-export-compliance'
      npm ERR! enoent This is most likely not a problem with npm itself
      npm ERR! enoent and is related to npm not being able to find a file.
      npm ERR! enoent
      

      Also, after running "cordova prepare" the plugin entry in the config.xml was changed to:

      <plugin name="cordova-plugin-ios-no-export-compliance" spec="file:custom_plugins/cordova-plugin-ios-no-export-compliance" />
      

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            maxtacco Max Mednik

            Dates

              Created:
              Updated:

              Slack

                Issue deployment