Develop our first own plugin/extension for Mozilla Firefox / Part 1 / First npm error on windows platform.

Firstly, you need instal this tool: JPM
Installing from GitHub to get latest features or working on jpm itself, use npm link to add the jpm global to your path:

git clone
cd jpm
npm install
npm link
And “hello” error:

Error: ENOENT, stat ‘C:\Users\%username%\AppData\Roaming\npm’

Easy fix:
npm install npm -g

Command reference

There are six jpm commands:

jpm init Create a skeleton add-on as a starting point for your own add-on.
jpm run Launch an instance of Firefox with your add-on installed.
jpm test Runs your add-on’s unit tests.
jpm xpi Package your add-on as an XPI file, which is the install file format for Firefox add-ons.
jpm post Package your add-on as an XPI file, then post it to some url.
jpm watchpost Package your add-on as an XPI file whenever there is a file changed, and post that to some url.
  • -b, --binary <path> Use the specified Firefox binary to run the add-on. Used in run and test.
  • -v, --verbose Prints additional debugging information.
  • --binary-args <CMDARGS> Passes other arguments into Firefox. Enclose multiple arguments in quotes.
  • --debug Enable the add-on debugger when running the add-on.
  • -p, --profile <PROFILE> Uses the profile name or path when running Firefox. Paths must start with either “./” or “/”, or be considered a profile name.
  • --prefs [path] Uses a JSON file or common js file which exports a JSON object. The keys of this object will be the pref names, the values will be the pref values.
  • -o, --overload [path] Uses either the specified [path] or the path set in the environment variables JETPACK_ROOT as the root for addon-sdk modules instead of the ones built into Firefox.
  • --post-url <URL> experimental Used to post a xpi to a URL.
  • jpm init Provides a series of prompts to create a package.json for an add-on.
  • jpm run Runs the current add-on.
  • jpm test Tests the current add-on.
  • jpm xpi Zips up the current add-on into a .xpi file.
  • jpm post experimental Zips up the current add-on into a .xpi file and post that to the --post-url.
  • jpm watchpost experimental Zips up the current add-on into a .xpi file and post that to the --post-url, every time a file in the current working directory changes.

Huurah… First step)

jpm init

This command initializes a new add-on from scratch.

Create a new directory, change into it, and run jpm init.

mkdir my-addon
cd my-addon
jpm init

You’ll then be asked to supply some information about your add-on: this will be used to create your add-on’s package.json file.

Most of these fields have a default, which is shown in brackets after the question. If you just press Enter, your add-on will get the default value.

Once you’ve supplied a value or accepted the default for these properties, you’ll be shown the complete contents of “package.json” and asked to accept it.

Then jpm will create an skeleton add-on, as a starting point for your own add-on development, with the following file structure:

  • my-addon
    • index.js
    • package.json
    • test
      • test-index.js