Common Errors
-
Mismatched anonymous define() modules ... § 1 -
Load timeout for modules: ... § 2 -
Error evaluating module ... § 3 -
Module name ... has not been loaded yet for context: ... § 4 -
Invalid require call § 5 -
No define call for ... § 6 -
Script error § 7 -
No matching script interactive for ... § 8 -
Path is not supported: ... § 9 -
Cannot use preserveLicenseComments and generateSourceMaps together § 10 -
importScripts failed for ... § 11
Mismatched anonymous define() modules ... § 1
-
Be sure to load all scripts that call define() via the RequireJS API. Do not manually code script tags in HTML to load scripts that have define() calls in them. -
If you manually code an HTML script tag, be sure it only includes named modules, and that an anonymous module that will have the same name as one of the modules in that file is not loaded. -
If the problem is the use of loader plugins or anonymous modules but the RequireJS optimizer is not used for file bundling, use the RequireJS optimizer. -
If the problem is the var define lint approach, use /*global define */ (no space before "global") comment style instead.
Load timeout for modules: ... § 2
-
There was a script error in one of the listed modules. If there is no script error in the browser's error console, and if you are using Firebug, try loading the page in another browser like Chrome or Safari. Sometimes script errors do not show up in Firebug. -
The path configuration for a module is incorrect. Check the "Net" or "Network" tab in the browser's developer tools to see if there was a 404 for an URL that would map to the module name. Make sure the script file is in the right place. In some cases you may need to use the paths configuration to fix the URL resolution for the script. -
The paths config was used to set two module IDs to the same file, and that file only has one anonymous module in it. If module IDs "something" and "lib/something" are both configured to point to the same "scripts/libs/something.js" file, and something.js only has one anonymous module in it, this kind of timeout error can occur. The fix is to make sure all module ID references use the same ID (either choose "something" or "lib/something" for all references), or use map config .
Error evaluating module ... § 3
Module name ... has not been loaded yet for context: ... § 4
//If this code is not in a define call, //DO NOT use require('foo'), but use the async //callback version: require(['foo'], function (foo) { //foo is now loaded. });
define(function (require) { var namedModule = require('name'); });
define(['require', 'name'], function (require) { var namedModule = require('name'); });
//THIS WILL FAIL define(['require'], function (require) { var namedModule = require('name'); });
require(['require', 'name'], function (require) { var namedModule = require('name'); });
define(function (require) { //Notice the space between require and the arguments. var namedModule = require ('name'); });
Invalid require call § 5
require('dependency', function (dependency) {});
require(['dependency'], function (dependency) {});
No define call for ... § 6
-
Did not call define() to declare a module. -
Or was part of a shim config that specified a string exports property that can be checked to verify loading, and that check failed. -
Or was part of a shim config that did not set a string value for the exports config option.
-
Threw a JavaScript syntax/evaluation error. -
Or there was a 404 error in IE where the script failed to load.
-
If the module calls define(), make sure the define call was reached by debugging in a script debugger. -
If part of a shim config, make sure the shim config's exports check is correct. -
If in IE, check for an HTTP 404 error or a JavaScript sytnax error by using a script debugger.
Script error § 7
No matching script interactive for ... § 8
Path is not supported: ... § 9
//DO NOT DO THIS require([' http://some.domain.dom/path/to/dependency.js '], function (dependency) {}); //Rather, do this: require.config({ paths: { 'dependency': ' http://some.domain.dom/path/to/dependency ' } }); require(['dependency'], function (dependency) {});
//Inside the build profile { paths: { 'dependency': 'empty:' } }
Cannot use preserveLicenseComments and generateSourceMaps together § 10
importScripts failed for ... § 11