locomotivemtl / locomotive-scroll

🛤 Detection of elements in viewport & smooth scrolling with parallax.
https://locomotivemtl.github.io/locomotive-scroll
MIT License
7.97k stars 1.12k forks source link

[ERROR] document is not defined #568

Open Niko7133 opened 1 month ago

Niko7133 commented 1 month ago

Hi guys, I'm trying to use Locomotive-scroll with astro, but I'm having big problems, despite having a maximally clean environment and very basic code, I'm getting this error

16:52:09 [ERROR] document is not defined
  Hint:
    Browser APIs are not available on the server.

    If the code is in a framework component, try to access these objects after rendering using lifecycle methods or use a "client:only" directive to make the component exclusively run on the client.

    See https://docs.astro.build/en/guides/troubleshooting/#document-or-window-is-not-defined for more information.

  Stack trace:
    at /Applications/MAMP/htdocs/Developer/Git/Bitozzi-Scale/node_modules/locomotive-scroll/dist/locomotive-scroll.js:261:9
    [...] See full stack trace in the browser, or rerun with --verbose.

I have been looking for the solution for 2 hours, can anyone help me? Pls don't insult me I'm a beginner :)