greensock/GSAP · error

Please gsap.registerPlugin(MotionPathPlugin)

Error message

Please gsap.registerPlugin(MotionPathPlugin)

What it means

MotionPathHelper's core init tries to locate a GSAP instance from its argument, window.gsap, or an existing module-scoped gsap. If none is found it warns that MotionPathPlugin must be registered. This is the general 'gsap not found' branch of _initCore (as opposed to error 17's 'plugin missing' branch).

Source

Thrown at src/MotionPathHelper.js:88

		});
	},
	_identityMatrixObject = {matrix:{a:1, b:0, c:0, d:1, e:0, f:0}},
	_getConsolidatedMatrix = target => (target.transform.baseVal.consolidate() || _identityMatrixObject).matrix,
	_findMotionPathTween = target => {
		let tweens = gsap.getTweensOf(target),
			i = 0;
		for (; i < tweens.length; i++) {
			if (tweens[i].vars.motionPath) {
				return tweens[i];
			} else if (tweens[i].timeline) {
				tweens.push(...tweens[i].timeline.getChildren());
			}
		}
	},
	_initCore = (core, required) => {
		let message = "Please gsap.registerPlugin(MotionPathPlugin)";
		_win = window;
		gsap = gsap || core || _win.gsap || console.warn(message);
		gsap && PathEditor.register(gsap);
		_doc = document;
		_body = _doc.body;
		_docEl = _doc.documentElement;
		if (gsap) {
			MotionPathPlugin = gsap.plugins.motionPath;
			MotionPathHelper.PathEditor = PathEditor;
			_context = gsap.core.context || function() {};
		}
		if (!MotionPathPlugin) {
			(required === true) && console.warn(message);
		} else {
			_initCopyToClipboard();
			_arrayToRawPath = MotionPathPlugin.arrayToRawPath;
			_rawPathToString = MotionPathPlugin.rawPathToString;
		}
	};

View on GitHub (pinned to 13e2b79054)

Solutions

  1. Load/import gsap core before MotionPathHelper
  2. Call gsap.registerPlugin(MotionPathPlugin) and register the helper: gsap.registerPlugin(MotionPathHelper) or new MotionPathHelper(...) after core loads
  3. Pass the core explicitly where the API accepts it

Example fix

<!-- before -->
<script src="MotionPathHelper.min.js"></script>
<script src="gsap.min.js"></script>
<!-- after -->
<script src="gsap.min.js"></script>
<script src="MotionPathPlugin.min.js"></script>
<script src="MotionPathHelper.min.js"></script>
Defensive patterns

Strategy: validation

Validate before calling

if (!window.gsap) { throw new Error('Load gsap core before MotionPathHelper'); }

Type guard

const hasGsapCore = () => typeof window !== 'undefined' && !!window.gsap;

Prevention

When it happens

Trigger: Loading MotionPathHelper before GSAP core exists on window; instantiating MotionPathHelper without gsap.registerPlugin(MotionPathPlugin) and without any core in scope; passing no core argument in non-window contexts.

Common situations: Script tag ordering (helper before gsap); bundler tree-shaking away the core import; using the helper in a worker/SSR context where window is unavailable.

Related errors


AI-assisted analysis of greensock/GSAP@13e2b79054 (2026-08-29). Data as JSON: /api/errors/b8584ad10832534b. Report an issue: GitHub.