-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ReferenceError: document is not defined at createTag (node >18) #149
Comments
I'm getting the same error as well on latest node version. Switching to 18.18.2 fixed it for me. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. |
This impacts more than just Next. I'm using this repo in a gatsby project am am running into the same issue. |
I confirm this error is gone if you dynamically import the Player component as @dzungmv suggested. This is my solution. // player.tsx
import dynamic from 'next/dynamic';
export const ReactLottiePlayer = dynamic(
async () => {
const ReactLottie = await import('@lottiefiles/react-lottie-player');
return ReactLottie.Player;
},
{ ssr: false }
); // page.tsx
'use client';
import { ReactLottiePlayer } from '@/lib/lottiefiles/player';
export function Page() {
return (
<ReactLottiePlayer
src="/animation.json"
speed={1}
loop
autoplay
/>
);
} Tested in Next.js v14.x |
My Project was complex so dynamic import was not feasible solution. It works fine on |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. |
downgraded from node22 to node20 |
is there any solution for node v22? |
Overview
Using NextJS, we got:
This has been reported as a potential bug related to the node version: Gamote/lottie-react#101.
Consuming repo
Labels
Type: Bug
label to this issue.The text was updated successfully, but these errors were encountered: