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

When "cordova prepare" creates package.json, it doesn't include all node modules

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: cordova-cli
    • Labels:
      None
    • Environment:

      Mac OS 10.13.2, cordova-cli 8.0.0.

      Description

      If you don't include a package.json in your project, my understanding (from here) was that running "cordova prepare" should create it, based on your config.xml.

      This normally works fine. But if I include a plugin with a local path in config.xml, e.g.

      <plugin name="cordova-plugin-test" spec="custom_plugins/cordova-plugin-test" />
      

      and then run "cordova prepare" using cordova-cli 8.0.0, it will no longer download all the plugins' dependencies to node_modules. It only puts the platform and plugins that I specified in config.xml there, not any of their dependencies. And the package.json that it generates doesn't include the local plugin. As a result, it can cause errors with other plugins later on.

      This wasn't the case with cordova-cli 7.x. Is it now a requirement that we include a package.json as well as a config.xml? This seems to mean that we need to maintain a duplicate list of plugin versions.

      For an example, run "cordova prepare" on the attached project, using cordova-cli 8.0.0. The config.xml requests the "cordova-custom-config" plugin, which has several dependencies. They won't be loaded unless there's already a package.json that also requests that plugin.

        Attachments

        1. CordovaTest3.zip
          39 kB
          Jacob Weber

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              jweber Jacob Weber
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: