aos: Uncaught TypeError: Cannot set property 'AOS' of undefined

Getting an error when trying to install AOS. Console leads me to line 8 which is the first function in the aos.js file. !function (e, t) { "object" == (typeof exports === "undefined" ? "undefined" : _typeof(exports)) && "object" == (typeof module === "undefined" ? "undefined" : _typeof(module)) ? module.exports = t() : "function" == typeof define && define.amd ? define([], t) : "object" == (typeof exports === "undefined" ? "undefined" : _typeof(exports)) ? exports.AOS = t() : e.AOS = t(); } am using the JS in the dist/ folder from the master branch. Not sure what else I am doing wrong. Please advise.

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Comments: 17 (1 by maintainers)

Most upvoted comments

Any update on this? I’m getting the same error.

Error: undefined is not an object (evaluating 'e.AOS=t()')

I’m using gulp to concat my files and minify them. Everything works well when importing the CSS and js scripts via CDN. Below are the CDN scripts I’m using.

https://unpkg.com/aos@next/dist/aos.js https://unpkg.com/aos@2.3.3/dist/aos.css

I can’t have external dependencies and wanted to simply copy and paste the CSS and js code from the script tags and place the code in their own local js and CSS files; however, I can’t get rid of the error above. The issue is occurring on Safari, Firefox, and Chrome.

what is the resolution of this? I’ve experiencing the same issue. I’ve concat’ the dist file with my script file and aos appears before my code.