# SystemJS Errors This page lists the SystemJS errors that you may encounter. ## 1 ### Import Map contains invalid JSON SystemJS Error #1 occurs when you have a `` element in your HTML page that has invalid JSON content (See [import maps documentation](https://github.com/systemjs/systemjs/blob/master/docs/import-maps.md)). A common mistake that causes this a trailing comma on the last module in the import map, which is invalid JSON. ```html ``` Note that this error also can occur for external import maps (those with `src=""` attribute). Check the network tab of your browser devtools to verify that the response body for the external import map is valid json. ## 2 ## Module did not instantiate SystemJS Error #2 occurs when a module fails to instantiate. This occurs when the instantiate hook returns a Promise that resolves with no value. This generally occurs when a module was downloaded and executed but did not call [`System.register()`](/docs/api.md#systemregisterdeps-declare) (or `define()` for AMD modules). To fix, ensure that the module calls System.register during its initial, top-level execution. Instantiation refers to downloading and executing the code for a module. The instantiation for a single module refers to an array that represents the module's dependencies, exports, and code. SystemJS has various methods of instantiating modules, generally involving either a ` ``` ## 7 ### Failed to fetch module - wrong HTTP status SystemJS Error #7 occurs when SystemJS attempted to load a module with [`fetch()`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API), but the HTTP response status was not >= 200 and < 300. This error occurs when using either the module-types or transform extras. The module-types extension is included in `system.js`, but not in `s.js`. When using the transform extra, SystemJS uses `fetch()` to load all modules. However, when using the module-types extension (included in system.js), SystemJS uses `fetch()` instead of ` ``` A "specifier" is the string name of a module. A specifier may be a URL (`/thing.js` or `https://unpkg.com/vue`) or a "bare specifier" (`vue`). Warning #W1 most commonly occurs when using bare specifiers. "Resolution" refers to converting a specifier into a URL. This happens in any of the following scenarios: - a module is loaded directly - `System.import('specifier')` - a module is loaded as a dependency - `System.register(['specifier'], ...)` or `define(['specifier'], ...)` - a module is resolved manually - `System.resolve('specifier')` To fix this warning, you may either use [import maps](/docs/import-maps.md) or [hook System.resolve](/docs/hooks.md#resolveid-parenturl---string): ```html ``` ## W2 ### Invalid package target - should have trailing slash SystemJS Warning #W2 occurs when an import map [trailing-slash package path mapping](https://github.com/WICG/import-maps#packages-via-trailing-slashes) on the left hand side with a trailing slash maps into a target address without a trailing slash (`/`). Trailing slash path mappings for packages are a way of mapping any subpath of the bare module specifier within a directory, allowing for imports such as `import 'my-package/moduleA.js'` and `import 'my-package/moduleB.js'` without needing explicit entries in the import map for both modules. ```html ``` SystemJS Warning #W2 is logged by SystemJS to implement [Step 6.1 of this part of the import maps spec](https://wicg.github.io/import-maps/#sort-and-normalize-a-specifier-map). ## W3 ### ID is not a valid URL to set in the registry SystemJS Warning #W3 occurs when you call `System.set(id, module)` with an invalid id. The SystemJS module registry is similar to a browser's module registry, which identifies modules by URL. As such, the module id passed to System.set should be a URL, not a bare specifier. Note that you should set full URLs in the module registry, not page-relative URLs. Setting non-URL IDs is not recommended, but can be supported by hooking the resolve function to ensure these IDs can be resolved. Typically System.resolve will always return a URL making these modules unloadable otherwise. ```js // bare specifiers are invalid System.set('foo', { some: 'value' }); // page-relative URLs are invalid System.set('/foo.js', { some: 'value' }); System.set('./foo.js', { some: 'value' }); // Full urls are valid System.set('http://example.com/foo.js', { some: 'value' }); ```