ionic-cli: Adding plugin from URL doesn't update package.json

Using command (example plugins):

ionic plugin add org.apache.cordova.contacts

will add an entry to package.json => cordovaPlugins array:

 "cordovaPlugins": [
    "org.apache.cordova.contacts"
  ]

But using such command (adding plugin from url, not package name):

ionic plugin add https://github.com/cordova-sms/cordova-sms-plugin.git

Wont add any entries to cordovaPlugins.

However, after use:

ionic state save

we got in package.json:

"cordovaPlugins": [
    "org.apache.cordova.contacts",
   {
      "locator": "https://github.com/cordova-sms/cordova-sms-plugin.git",
      "id": "com.cordova.plugins.sms"
    }
  ],

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 35 (1 by maintainers)

Most upvoted comments

@mhhansen @mehrad-rafigh Have a look to the previous @jakub-g comment. I think you should use the --save option. It’s the same effect but in the config.xml file.

After all, this isn’t that bad. That don’t really make sens to store Cordova plugins informations (who’s managed by Cordova) in the NPM file. It seems more clear to store Cordova’s stuff in Cordova’s config file.

It works on ionic 1.7.14 Make sure you run ionic plugin add not cordova plugin add command.

This should be working in the latest beta - npm install -g ionic@beta.

also happens to me:

running:

ionic plugin add https://github.com/apache/cordova-plugin-whitelist.git

doesn’t add nothing to package.json. Although:

$ cordova plugin list
...
cordova-plugin-crosswalk-webview 1.0.1-dev "Crosswalk WebView Engine"
cordova-plugin-whitelist 1.0.1-dev "Whitelist"
...

Also nothing on package.json after this:

$ ionic state save
Saving your Ionic app state of platforms and plugins
Saved platform
There was no fetch.json file available to restore plugin information from.
Restoring plugins from scanning the plugins folder is still being worked on.
Saved plugins
Saved package.json

@wardenlzr If you ever see that error, it means the plugin you’re trying to add doesn’t yet support Cordova 7. You can either downgrade to Cordova 6 or open an issue in the repo for that Cordova plugin.

+1

this won’t add pluginName into package.json:

ionic start --v2 myApp
ionic plugin add pluginName

but I’ve managed to save it by running (not sure why, ref article): ionic state save

Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.0.0
ios-deploy version: 1.9.0
ios-sim version: 5.0.13
OS: macOS Sierra
Node Version: v6.9.3
Xcode version: Xcode 8.2.1 Build version 8C1002

@tobiasfiechter I don’t know but I did it since there is no other way to tack installed plugin at the moment

Ionic version 2.0.0-beta.17, the issue still persists. I am trying to run: ionic plugin add ../cordova-plugin-ble-central (which is a cloned repository with my own change). Plugin is installed but nothing is added to package.json file.

also still seeing this issue. I have to manually keep my package.json up to date