Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Can't resolve dependency "epi.globalcommandregistry" when setting up a custom command


I have the following javascript in the file ClientResources/Scripts/widgets/media/Mediacommands.js:

require(['dojo/aspect', 'epi/dependency', 'samples/media/MediaUpdateCommand'], function (aspect, dependency, MediaUpdateCommand) {

    var handle,
		key = 'epi.cms.globalToolbar',
		registry = dependency.resolve('epi.globalcommandregistry'),
		callback = function (identifier, provider) {
		    if (identifier !== key) {

		    provider.addCommand(new MediaUpdateCommand(), {
		        showLabel: true


    handle = aspect.after(registry, 'registerProvider', callback, true);

My module.config looks like this:


This is intended to add a button to the Editor toolbar, and *sometimes* works. However around 70% of the time I see the error Can't resolve dependency "epi.globalcommandregistry" in the console.

This corresponds to the line registry = dependency.resolve('epi.globalcommandregistry'), in the javascript above.

Is there any reason why the dependency can't be resolved at some times and more to the point, how can I ensure it's resolved every time?



Mar 20, 2015 15:51


I suggest that you create an init module on the client since this will make the code run at the right time. Here is a copy paste example from something I worked on recently:


<clientModule initializer="[your module class including namespace]">
<add dependency="CMS" type="Require RunAfter" />

Client module sample:

    // Pull in the patches. Not used here, just evaluated, since this is the first module loaded when starting the application.

function (
) {

    return declare([_Module], {
        // summary:
        //		Template module implementation.
        // tags:
        //      internal

        _settings: null,

        constructor: function (settings) {
            this._settings = settings;

        initialize: function () {

            var commandregistry = dependency.resolve("epi.globalcommandregistry");

            //We need to wait for the viewsettings to initialized before creating the global toolbar command provider
            commandregistry.registerProvider("epi.cms.globalToolbar", new AddItemFromTemplateCommandProvider({templatesRoot : this._settings.templatesRoot}));

Mar 25, 2015 8:22


That did it for me (specifically the module.config settings) - thanks!.

Mar 30, 2015 12:57
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.