Skip to main content



Generating a package.json for a Cordova plugin


The package.json file is a file which describes your Cordova plugin, containing information such as its description and a version. It should mirror your plugin.xml file as much as possible.

This is an example, of a valid package.json file, from the Forge's File Viewer plugin:

  "name": "File-Viewer-Plugin",
  "version": "1.0.1",
  "description": "File Viewer Plugin for Cordova Applications",
  "cordova": {
    "id": "com.outsystems.documentpreview",
    "platforms": [
  "dependencies": {},
  "devDependencies": {},
  "repository": {
    "type": "git",
    "url": ""
  "keywords": [
  "author": "OutSystems Experts",
  "license": "The MIT License (MIT)",
  "bugs": {
        "url": ""
  "homepage": ""



In order to ease the creation of a valid package.json file, you can use the plugman NPM package to do it. It will inspect the plugin's plugin.xml file. In order to do so:

  1. Install Node.js
  2. Install the plugman NPM package, using "npm install -g plugman"
  3. Fetch the plugin using Git, using "git clone <plugin URL>"
    1. If the plugin is included within a Zip Resource file, you should instead extract its contents to a folder
    2. If the plugin is specified via NPM identifier, there should be no issue, as these packages already require the file in place
  4. Use the "plugman createpackagejson <path to the plugin's root folder>" command to start a wizard before creating the file; this wizard will have default answers derived from the corresponding "plugin.xml" file
  5. Place the generated "package.json" file into the root folder of your plugin
    1. If you are not the owner of the plugin on GitHub, you can fork it and use the "Upload Files" option to create it; don't forget to update your module to point to the forked repository URL
    2. If the plugin is included via a Zip resource, just add it to the archive and update the resource on the module
  6. Refresh references of your mobile app and try generating the app again
  • Was this article helpful?