Help with "No JS module 'ui' found in search path"


I’m quite new to gjs and I try to modify an existing extension for my own purpose.

This extension has a main file extension.js and several other .js files (modules ?) that are called.

In one of these files (let’s call it test.js for convenience), I do this:

const Main = imports.ui.main;

but I receive the following error message in console:

No JS module 'ui found in search path

I understand that the ui module is not found in search path in test.js. How can I add it to the search path?

Thanks for any help,

Hi, can you please share your source code so we can see the problem?


thanks for the answer. In the meanwhile, I’ve found the answer, that is the following code has to be inserted at the beginning of extensions.js:

const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();

const Test = Me.imports.test;

and in test.js I can do:

Main = imports.ui.main;

Best regards,

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.