jpm test isn't loading my external libraries

78 views
Skip to first unread message

z iz

unread,
Oct 23, 2015, 12:47:00 AM10/23/15
to mozilla-labs-jetpack

I'm getting this error when running "jpm test" for my add-on that's using menuitem:


...........console.error: librejs: 
  Message: Module `menuitem` is not found at resource://gre/modules/commonjs/menuitem.js
  Stack:
    exports.UI.init@resource://jid1-ktlzuoiikvffew-at-jetpack/lib/ui.js:140:24
@resource://jid1-ktlzuoiikvffew-at-jetpack/lib/ui.js:190:1
@resource://jid1-ktlzuoiikvffew-at-jetpack/lib/main.js:37:1
@resource://jid1-ktlzuoiikvffew-at-jetpack/test/test-bug-frozen.js:23:12
 

Here's my package.json: https://github.com/nikolas/LibreJS/blob/jpm/package.json


Does anyone know how to fix this?


I'm using jpm version 1.0.3.

Julien Wajsberg

unread,
Oct 23, 2015, 3:00:38 AM10/23/15
to mozilla-la...@googlegroups.com
Hi,

what are you trying to do ?
Are you using <menuitem> from XUL ? What do you want to do with this element ? (I'm not very familiar with XUL anymore :) ).

XUL add-ons don't work with Jetpack. You can have a look at [1] for an introduction.

[1] https://developer.mozilla.org/en-US/Add-ons/SDK


--
You received this message because you are subscribed to the Google Groups "mozilla-labs-jetpack" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mozilla-labs-jet...@googlegroups.com.
To post to this group, send email to mozilla-la...@googlegroups.com.
Visit this group at http://groups.google.com/group/mozilla-labs-jetpack.
For more options, visit https://groups.google.com/d/optout.

adrian aichner

unread,
Oct 23, 2015, 5:30:15 AM10/23/15
to mozilla-labs-jetpack
Use a relative path. "./menuitrm" or what the relative position is. Backtrace shows it is looked up in firefox, not your add-on.


mozilla-la...@googlegroups.com wrote:
--
You received this message because you are subscribed to the Google Groups "mozilla-labs-jetpack" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mozilla-labs-jet...@googlegroups.com.
To post to this group, send email to mozilla-la...@googlegroups.com.
Visit this group at http://groups.google.com/group/mozilla-labs-jetpack.
For more options, visit https://groups.google.com/d/optout.
Gesendet mit Firefox OS

Nik Nyby

unread,
Oct 23, 2015, 7:57:21 AM10/23/15
to mozilla-la...@googlegroups.com
I'm using menuitem from npm as described here:
https://developer.mozilla.org/en-US/Add-ons/SDK/Tutorials/Using_third-party_modules_%28jpm%29
> You received this message because you are subscribed to a topic in the
> Google Groups "mozilla-labs-jetpack" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/mozilla-labs-jetpack/m5UfyFivfFs/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to

Nik Nyby

unread,
Oct 23, 2015, 7:59:26 AM10/23/15
to mozilla-la...@googlegroups.com
Do you need to use a relative path for node modules? like,
require('../node_modules/menuitem/menuitem.js')? That seems like it
should be handled automatically by jpm. Anyways, if that's the case,
this documentation is then incorrect:
https://developer.mozilla.org/en-US/Add-ons/SDK/Tutorials/Using_third-party_modules_%28jpm%29

Since it describes using menuitem like this:

var menuitem = require("menuitem");
> You received this message because you are subscribed to a topic in the
> Google Groups "mozilla-labs-jetpack" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/mozilla-labs-jetpack/m5UfyFivfFs/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to

Adrian Aichner

unread,
Oct 23, 2015, 9:29:56 AM10/23/15
to mozilla-labs-jetpack
From
https://github.com/nikolas/LibreJS/blob/master/README
I gather you used cfx previously, so you must have adjusted relative paths already to make tests run under jpm?

Which version of jpm are you using?

jpm 1.0.3 is just out and it is required to use at least 1.0.2 for your add-on to work in recent Nightly Firefox builds.
> To post to this group, send email to mozilla-la...@googlegroups.com.
> Visit this group at http://groups.google.com/group/mozilla-labs-jetpack.
> For more options, visit https://groups.google.com/d/optout.
>
> Gesendet mit Firefox OS
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "mozilla-labs-jetpack" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/mozilla-labs-jetpack/m5UfyFivfFs/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to

Nik Nyby

unread,
Oct 23, 2015, 9:35:45 AM10/23/15
to mozilla-la...@googlegroups.com
I'm using jpm 1.0.3. Yes, I'm working on converting this extension
over from cfx to jpm. The 'jpm' branch on that git repository is where
I'm doing that conversion. So yeah, I have adjusted all of the paths
to my own scripts to be compatible with jpm.

I'm just wondering if I'm also expected to do this for external npm
modules. If so, will I need to remove the node_modules directory from
my .jpmignore? https://github.com/nikolas/LibreJS/blob/jpm/.jpmignore
Currently I'm only allowing a whitelist of files to be included in the
xpi, otherwise a bunch of unnecessary stuff is included making the xpi
really big, for example, dev-specific things like node_modules/jshint,
etc.
>> > email to mozilla-labs-jet...@googlegroups.com.
>> > To post to this group, send email to mozilla-la...@googlegroups.com.
>> > Visit this group at http://groups.google.com/group/mozilla-labs-jetpack.
>> > For more options, visit https://groups.google.com/d/optout.
>> >
>> > Gesendet mit Firefox OS
>> >
>> > --
>> > You received this message because you are subscribed to a topic in the
>> > Google Groups "mozilla-labs-jetpack" group.
>> > To unsubscribe from this topic, visit
>> >
>> > https://groups.google.com/d/topic/mozilla-labs-jetpack/m5UfyFivfFs/unsubscribe.
>> > To unsubscribe from this group and all its topics, send an email to
>> > mozilla-labs-jet...@googlegroups.com.
>> > To post to this group, send email to mozilla-la...@googlegroups.com.
>> > Visit this group at http://groups.google.com/group/mozilla-labs-jetpack.
>> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "mozilla-labs-jetpack" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/mozilla-labs-jetpack/m5UfyFivfFs/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> mozilla-labs-jet...@googlegroups.com.

Nik Nyby

unread,
Oct 23, 2015, 10:04:39 AM10/23/15
to mozilla-la...@googlegroups.com
Alright, so my issue was that node_modules was being ignored by jpm.
I needed to add !/node_modules/** to my .jpmignore.

I hope this node_modules / jpm problem is sorted out soon:
https://github.com/mozilla-jetpack/jpm/issues/298

Adrian Aichner

unread,
Oct 23, 2015, 10:30:50 AM10/23/15
to mozilla-labs-jetpack
I use something like this in .jpmignore:

node_modules/
!node_modules/pouchdb/dist/pouchdb.js

I am having trouble running jpm test on your jpm branch.
It hangs after loading bootstrap.js for firefox-trunk (nightly Firefox) on ubuntu.

Yes, since this works with firefox (release) this is caused by your bundled bootstrap.js
See
https://bugzilla.mozilla.org/show_bug.cgi?id=1213102

with firefox I also get as far as:

console.error: librejs:
  Message: Module `menuitem` is not found at resource://gre/modules/commonjs/menuitem.js
  Stack:
    exports.UI.init@resource://jid1-ktlzuoiikvffew-at-jetpack/lib/ui.js:140:24

I notice you provide your own install.rdf and bootstrap.js.
Is there a specific reason you have to do this? jpm (as a warning says) can auto-generate them for you:

PM [info] Checking compatability bootstrap.js and install.rdf for xpi
JPM [warning] Using existing install.rdf. This file is usually auto-generated.
JPM [warning] Using existing bootstrap.js. This file is usually auto-generated.
JPM [info] Creating fallbacks if they are necessary..
>> > To post to this group, send email to mozilla-la...@googlegroups.com.
>> > Visit this group at http://groups.google.com/group/mozilla-labs-jetpack.
>> > For more options, visit https://groups.google.com/d/optout.
>> >
>> > Gesendet mit Firefox OS
>> >
>> > --
>> > You received this message because you are subscribed to a topic in the
>> > Google Groups "mozilla-labs-jetpack" group.
>> > To unsubscribe from this topic, visit
>> >
>> > https://groups.google.com/d/topic/mozilla-labs-jetpack/m5UfyFivfFs/unsubscribe.
>> > To unsubscribe from this group and all its topics, send an email to
>> > To post to this group, send email to mozilla-la...@googlegroups.com.
>> > Visit this group at http://groups.google.com/group/mozilla-labs-jetpack.
>> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "mozilla-labs-jetpack" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/mozilla-labs-jetpack/m5UfyFivfFs/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to

Adrian Aichner

unread,
Oct 23, 2015, 10:42:06 AM10/23/15
to mozilla-labs-jetpack
Pulled your .jpmignore update and all 212 tests are pass for me with firefox 41.0.2.

I can run some tests with nightly when I mv install.rdf and bootstrap.js out of the way.

Looks you have some incorrect use of lexical scoping here:

console.error: librejs:
JPM [error]   Message: ReferenceError: can't access lexical declaration `settingsManager' before initialization
  Stack:
    @resource://jid1-ktlzuoiikvffew-at-jetpack/lib/settings/settings_tab.js:28:1
@resource://jid1-ktlzuoiikvffew-at-jetpack/lib/ui.js:28:20

@resource://jid1-ktlzuoiikvffew-at-jetpack/lib/main.js:37:1
@resource://jid1-ktlzuoiikvffew-at-jetpack/test/test-bug-frozen.js:23:12



>>> > To post to this group, send email to mozilla-la...@googlegroups.com.
>>> > Visit this group at http://groups.google.com/group/mozilla-labs-jetpack.
>>> > For more options, visit https://groups.google.com/d/optout.
>>> >
>>> > Gesendet mit Firefox OS
>>> >
>>> > --
>>> > You received this message because you are subscribed to a topic in the
>>> > Google Groups "mozilla-labs-jetpack" group.
>>> > To unsubscribe from this topic, visit
>>> >
>>> > https://groups.google.com/d/topic/mozilla-labs-jetpack/m5UfyFivfFs/unsubscribe.
>>> > To unsubscribe from this group and all its topics, send an email to
>>> > To post to this group, send email to mozilla-la...@googlegroups.com.
>>> > Visit this group at http://groups.google.com/group/mozilla-labs-jetpack.
>>> > For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "mozilla-labs-jetpack" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/mozilla-labs-jetpack/m5UfyFivfFs/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
Reply all
Reply to author
Forward
0 new messages