本文介绍了JPM不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚尝试使用 JPM ,并且我什么都不能工作.

I've just tried using JPM for the first time, and I can't get anything to work.

我的index.js文件如下:

My index.js file looks like this:

const actionButton = require('sdk/ui/button/action');
const TAG = "Addon Scratchpad / Index  ";

console.log(TAG+'in index.js');

var button = actionButton.ActionButton({
  id: "my-button",
  label: "my button",
  icon: {
    "16": "./tool-scratchpad-16.png",
    "32": "./tool-scratchpad-32.png"
  },
  onClick: function() {
    debugger;
    console.log(TAG+'button clicked');
  }
});

文件夹结构是标准的:index.jspackage.json文件以及带有png资产按钮的data文件夹.

The Folder structure is standard: index.js and package.json files and a data folder with the button png assets.

jpm run导致浏览器打开.但是没有生成任何按钮,终端或控制台中没有错误,插件调试器声称此页面没有源."

jpm run results in the browser opening. But no button is generated, there are no errors in the terminal or console, the addon debugger claims "This page has no sources."

jpm test导致没有运行测试,也没有引发任何错误.

jpm test results in no tests being run and no errors thrown.

jpm run --debugger不会启动调试器.

在JPM安装过程中没有错误(我已卸载并全局重新安装以进行检查).

There were no errors during JPM installation (I uninstalled and reinstalled globally to check).

index.js位于目录的根目录中,这不是我常用的目录,但这是:

index.js is in the root of the directory, which isn't what I'm used to, but this is apparently normal:

如果我将xpi拆包,它看起来很正常.如果我通过拖动到Firefox进行安装,则同样的问题仍然存在.

If I unpackage the xpi it looks normal. If I install it by dragging to Firefox the same issues persist.

我很困惑.有什么想法为什么我无法使它正常工作?

I'm stumped. Any ideas why I can't get it to work?

推荐答案

jpm 0.0.25进行了一些重要更改,仅适用于Firefox 38(当前的夜间版本).

jpm 0.0.25 has some important changes in it that will only work with Firefox 38 ( the current nightly version ).

目前的快速解决方案是将jpm版本固定在0.0.23:

The quick fix for now is to pin your jpm version at 0.0.23:

npm install -g [email protected]

我记录了这个jpm问题: https://github.com/mozilla/jpm/issues/261

I logged this jpm issue: https://github.com/mozilla/jpm/issues/261

这篇关于JPM不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 01:37