Common Errors

This page lists errors that are generated by RequireJS. If the following information does not fix the problem, you can ask on the RequireJS list or open an issue. In either case it is best to have an example or detailed explanation of the problem, hopefully with steps to reproduce.

Mismatched anonymous define() modules ...§ 1

If you manually code a script tag in HTML to load a script with an anonymous define() call, this error can occur.

Also seen if you manually code a script tag in HTML to load a script that has a few named modules, but then try to load an anonymous module that ends up having the same name as one of the named modules in the script loaded by the manually coded script tag.

Finally, if you use the loader plugins or anonymous modules (modules that call define() with no string ID) but do not use the RequireJS optimizer to combine files together, this error can occur. The optimizer knows how to name anonymous modules correctly so that they can be combined with other modules in an optimized file.

To avoid the error:

Load timeout for modules: ...§ 2

Likely causes and fixes:

Error evaluating module ...§ 3

An error occured when the define() function was called for the module given in the error message. It is an error with the code logic inside the define function. The error could happen inside a require callback.

In Firefox and WebKit browsers, a line number and file name will be indicated in the error. It can be used to locate the source of the problem. Better isolation of the error can be done by using a debugger to place a breakpoint in the file that contains the error.

Module name ... has not been loaded yet for context: ...§ 4

This occurs when there is is a require('name') call, but the 'name' module has not been loaded yet.

If you are using the simplified define wrapper, make sure you have require as the first argument to the definition function:

define(function (require) {
    var namedModule = require('name');
});

If you are listing dependencies in the dependency array, make sure that require and name are in the dependency array:

define(['require', 'name'], function (require) {
    var namedModule = require('name');
});

Or, if part of a require() callback:

require(['require', 'name'], function (require) {
    var namedModule = require('name');
});

Be sure that require('name') only occurs inside a define() definition function or a require() callback function, never in the global space by its own.

No matching script interactive for ...§ 5

This error only shows up in some IE browsers. Most likely caused by loading a script that calls define() but was loaded in a plain script tag or via some other call, like an eval() of a JavaScript string.

To avoid the error, be sure to load all scripts that call define via the RequireJS API.