5

jpm version is 1.1.3
npm version is 2.15.8
Node version is 4.4.7
Firefox version is 48.0

Content of index.js:

var self = require("sdk/self");  
console.log("************************************");

Output of "jpm run" command

JPM [info] Starting jpm run on My Jetpack Addon  
JPM [info] Creating a new profile

As per the content of the index.js file, a line of * symbols should be output on the console. But, the desire output is not in the console.

Is there any problem with the code?

Content of my package.json file:

{  
  "title": "My Jetpack Addon",  
  "name": "temp",   
  "version":  "0.0.1",  
  "description": "A basic add-on",
  "main": "index.js",    
  "author": "",   
  "engines": {  
      "firefox": ">=38.0a1",  
       "fennec": ">=38.0a1"   },   
   "license": "MIT",  
   "keywords": [  
      "jetpack"   ]  
}
Makyen
  • 31,849
  • 12
  • 86
  • 121
  • How do you run index.js? – nnnnnn Aug 11 '16 at 04:38
  • Please [edit] the question to include the contents of your [*package.json*](https://developer.mozilla.org/en-US/Add-ons/SDK/Tools/package_json) file. Have you run [`jpm init`](https://developer.mozilla.org/en-US/Add-ons/SDK/Tutorials/Getting_Started_(jpm)#Initializing_an_empty_add-on)? – Makyen Aug 11 '16 at 05:32
  • At First I run jpm init to create a dummy add-on Second: I use "jpm run" to run the add-on. – CHINMAYA DEHURY Aug 11 '16 at 06:56

1 Answers1

13

jpm run does not work with the release version of Firefox 48, or later

The issue is not jpm, but that you are attempting to use it with the release version of Firefox 48. As of Firefox 48, Mozilla has disabled the ability of the setting the preference xpinstall.signatures.required to false to permit unsigned add-ons to be loaded. Thus, your add-on is being added to that Firefox profile, but is disabled:

jpm run

Disabled add-on with jpm run

You need to install and use a different version of Firefox

To test your add-on, you will need to install a different version of Firefox and use the -b option to jpm run to tell jpm which version of Firefox to use. Assuming you don't want an old version of Firefox, your options are Firefox Developer Edition, Firefox Nightly, Unbranded Beta, or Unbranded Release.

[Note (2016-08-11): My testing over the last couple of days has shown that the Unbranded Release version of Firefox 48, and the Unbranded Beta version of Firefox 49.0b2 exhibit problems which were not in 48 or 49 while those versions were Nightly or Developer Edition. These problems do not exist in the current Developer Edition (50.0a2) or Nightly (51.0a2). In other words, I have an add-on which works in Developer Edition (50.0a2), & Nightly (51.0a2), and worked in both Developer Edition (49.0a2), and Developer Edition (48.0a2), but which does not work in Unbranded Release (48.0), or Unbranded Beta (49.0b2). Thus, I recommend against using the Unbranded versions of Firefox at this time.]

The simplest thing to do is to download Firefox Nightly and start jpm using:

jpm run -b nightly 

Enabled add-on with jpm run -b nightly

The word nightly is a shortcut which resolves to the default location for Firefox Nightly to be installed. Depending on what OS you are using, there are other shortcut names which can be used (e.g. firefox, firefoxdeveloperedition, beta, nightly, and aurora). However, they do not resolve correctly on all operating systems. You always have the option of specifying the complete path to the Firefox version you desire to use.

The other alternative to using the -b option to specifying the path is to change the JPM_FIREFOX_BINARY environment variable to the path to the Firefox executable which you wish to use with jpm.

Note: I have updated the installation documentation for jpm on MDN to reflect the need to have a non-release version for Firefox as of Firefox 48. If you have recently visited that page, you may need to use Ctrl-F5 to refresh the page in order to see the new content.

Makyen
  • 31,849
  • 12
  • 86
  • 121
  • 1
    Can't believe I got hung up on these initial stages of "getting started", basic signing and running the app. They should really improve documentation to make it clear. I see why people develop for Chrome ahead of FF – Clam Sep 03 '16 at 07:49
  • @Clam, The signing part, and the frustration of it, is relatively recent (only fully enforced for the last month, or so). The primary reason people develop add-ons for Chrome instead of Firefox is that Chrome has a larger market share. Firefox support of [WebExtensions](https://developer.mozilla.org/en-US/Add-ons/WebExtensions) will allow both Firefox to leverage much of the Chrome add-on development and extension developers to leverage a considerable amount of code from Chrome to Firefox. Should help all around. Still have to have it signed, though, but can use them as temporary add-ons. – Makyen Sep 03 '16 at 08:00