liabru/matter-js · warning
Plugin.use: does not specify any dependencies to install.
Error message
Plugin.use: does not specify any dependencies to install.
What it means
Plugin.use was called but the resulting module.uses list is empty, meaning there are no dependencies to install. Since installing nothing is almost certainly a mistake (why call Plugin.use?), Matter.js warns and returns early without running dependency resolution. Note: the call itself also mutates module.uses to [].
Source
Thrown at src/core/Plugin.js:128
* For installing plugins on `Matter` see the convenience function `Matter.use`.
* Plugins may be specified either by their name or a reference to the plugin object.
* Plugins themselves may specify further dependencies, but each plugin is installed only once.
* Order is important, a topological sort is performed to find the best resulting order of installation.
* This sorting attempts to satisfy every dependency's requested ordering, but may not be exact in all cases.
* This function logs the resulting status of each dependency in the console, along with any warnings.
* - A green tick ✅ indicates a dependency was resolved and installed.
* - An orange diamond 🔶 indicates a dependency was resolved but a warning was thrown for it or one if its dependencies.
* - A red cross ❌ indicates a dependency could not be resolved.
* Avoid calling this function multiple times on the same module unless you intend to manually control installation order.
* @method use
* @param module {} The module install plugins on.
* @param [plugins=module.uses] {} The plugins to install on module (optional, defaults to `module.uses`).
*/
Plugin.use = function(module, plugins) {
module.uses = (module.uses || []).concat(plugins || []);
if (module.uses.length === 0) {
Common.warn('Plugin.use:', Plugin.toString(module), 'does not specify any dependencies to install.');
return;
}
var dependencies = Plugin.dependencies(module),
sortedDependencies = Common.topologicalSort(dependencies),
status = [];
for (var i = 0; i < sortedDependencies.length; i += 1) {
if (sortedDependencies[i] === module.name) {
continue;
}
var plugin = Plugin.resolve(sortedDependencies[i]);
if (!plugin) {
status.push('❌ ' + sortedDependencies[i]);
continue;
}View on GitHub (pinned to acb99b6f87)
Solutions
- Pass the plugins array: Plugin.use(module, [myPlugin]).
- Verify the plugins variable is defined and non-empty before calling (log it).
- Remove the Plugin.use call entirely if the module genuinely has no dependencies.
- If plugins are declared on module.uses already, don't pass an empty array which would still be empty — confirm module.uses was populated first.
Example fix
// before Plugin.use(Matter, myPlugins); // myPlugins was undefined // after const myPlugins = [MyPlugin]; if (myPlugins.length) Plugin.use(Matter, myPlugins);
Defensive patterns
Strategy: validation
Validate before calling
const plugins = myPlugins || [];
if (plugins.length > 0) {
Matter.Plugin.use(module, plugins);
} Type guard
function hasDependencies(mod, plugins) {
return ((mod && mod.uses) || []).concat(plugins || []).length > 0;
} Prevention
- Assert the plugins array is non-empty before Plugin.use
- Check imports that supply the plugin list actually resolved
- Skip the Plugin.use call when there is genuinely nothing to install
When it happens
Trigger: Plugin.use(module) with plugins argument omitted/null, or Plugin.use(module, []) — any call where (module.uses || []).concat(plugins || []).length === 0.
Common situations: Passing a variable that is undefined/null due to a failed import; typo in the variable name; conditionally-built array that ended up empty.
Understand the failure class
Background: "Must pass :limit option" / "Missing required option" — required option errors explained — this error's family across 41 libraries.
Related errors
- MouseConstraint.create: options.mouse was undefined, options
- Plugin.register: does not implement all required fields.
- Plugin.register: was upgraded to
- Plugin.register: can not be downgraded to
- Plugin.register: is already registered to different plugin o
AI-assisted analysis of liabru/matter-js@acb99b6f87 (2026-09-02).
Data as JSON: /api/errors/13cb694e16047901.
Report an issue: GitHub.