摩根大通不工作
JPM not working
我刚刚第一次尝试使用 JPM,但无法正常工作。
我的 index.js 文件如下所示:
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.js
和 package.json
文件以及带有按钮 png
资产的 data
文件夹。
jpm run
导致浏览器打开。但是没有生成按钮,终端或控制台中没有错误,插件调试器声称 "This page has no sources."
jpm test
导致没有测试 运行 并且没有错误抛出。
jpm run --debugger
不启动调试器。
JPM 安装过程中没有错误(我全局卸载并重新安装以检查)。
index.js 在目录的根目录中,这不是我习惯的,但这是 apparently normal:
your main file is "index.js", and it is found directly in your add-on's root.
如果我解压 xpi,它看起来很正常。如果我通过拖到 Firefox 来安装它,同样的问题仍然存在。
我很难过。为什么我无法让它工作有什么想法吗?
jpm 0.0.25 有一些重要的变化,只适用于 Firefox 38(当前的夜间版本)。
目前的快速解决方法是将您的 jpm 版本固定在 0.0.23:
npm install -g jpm@0.0.23
我记录了这个 jpm 问题:https://github.com/mozilla/jpm/issues/261
我刚刚第一次尝试使用 JPM,但无法正常工作。
我的 index.js 文件如下所示:
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.js
和 package.json
文件以及带有按钮 png
资产的 data
文件夹。
jpm run
导致浏览器打开。但是没有生成按钮,终端或控制台中没有错误,插件调试器声称 "This page has no sources."
jpm test
导致没有测试 运行 并且没有错误抛出。
jpm run --debugger
不启动调试器。
JPM 安装过程中没有错误(我全局卸载并重新安装以检查)。
index.js 在目录的根目录中,这不是我习惯的,但这是 apparently normal:
your main file is "index.js", and it is found directly in your add-on's root.
如果我解压 xpi,它看起来很正常。如果我通过拖到 Firefox 来安装它,同样的问题仍然存在。
我很难过。为什么我无法让它工作有什么想法吗?
jpm 0.0.25 有一些重要的变化,只适用于 Firefox 38(当前的夜间版本)。
目前的快速解决方法是将您的 jpm 版本固定在 0.0.23:
npm install -g jpm@0.0.23
我记录了这个 jpm 问题:https://github.com/mozilla/jpm/issues/261