Jump to content


document is not defined

Go to solution Solved by mrfrancescomoro,

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hi everyone,

I am completely new to both GSAP and Gulp and I'm having troubles to run gulp after gsap installation.

Don't know what to do.

I have installed gsap this way:
"npm install --save-dev gsap"

and after that I add to my gulpfile.js gsap = require('gsap');


after that, i run gulp on my cmd and this shows up:

                        _doc = document,

ReferenceError: document is not defined
    at Function.<anonymous> (C:\xampp\htdocs\00testing_code\node_modules\gsap\src\uncompressed\TweenMax.js:2535:11)
    at check (C:\xampp\htdocs\00testing_code\node_modules\gsap\src\uncompressed\TweenMax.js:5858:61)
    at new Definition (C:\xampp\htdocs\00testing_code\node_modules\gsap\src\uncompressed\TweenMax.js:5875:10)
    at window._gsDefine (C:\xampp\htdocs\00testing_code\node_modules\gsap\src\uncompressed\TweenMax.js:5880:12)
    at Array.<anonymous> (C:\xampp\htdocs\00testing_code\node_modules\gsap\src\uncompressed\TweenMax.js:2488:11)
    at C:\xampp\htdocs\00testing_code\node_modules\gsap\src\uncompressed\TweenMax.js:7634:9
    at Object.<anonymous> (C:\xampp\htdocs\00testing_code\node_modules\gsap\src\uncompressed\TweenMax.js:7645:3)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)

What did I do wrong?!?

Am I missing something?


Thanks in advance.

Link to comment
Share on other sites

Why are you requiring GSAP inside gulp? You generally shouldn't need to do this. If you require GSAP inside a node environment, which gulp is, it will throw an error because of the CSSPlugin.


If you know what you are doing, this thread might help, but I wouldn't recommend doing that if you plan on using the CSSPlugin or Draggable.


Link to comment
Share on other sites

  • Solution

Actually, I didn't know what I was doing  :mrgreen:

I didn't NEED that, I just thought it was the right way...


Thanks for the support anyway.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.