lottie-react
lottie-react copied to clipboard
Upgrade to support react v19
Can you please upgrade the libraries to support the latest version of react v19.
-----> Installing dependencies Installing node modules (package.json) npm error code ERESOLVE npm error ERESOLVE unable to resolve dependency tree npm error npm error While resolving: [email protected] npm error Found: [email protected] npm error node_modules/react npm error react@"^19.0.0" from the root project npm error npm error Could not resolve dependency: npm error peer react@"^16.8.0 || ^17.0.0 || ^18.0.0" from [email protected] npm error node_modules/lottie-react npm error lottie-react@"^2.4.0" from the root project
Facing this error
As a temporary fix, you can override the dependencies in package.json. This worked for me but you'll need to thoroughly test that all of your animations are still working as expected. Add this to the root level:
"overrides": {
"lottie-react": {
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
},
https://github.com/Gamote/lottie-react/pull/121 fixes this
Hey there, the lottie-react@^2.4.1 should fix this issue.
I'm not quite sure with React, but Next.js 15 (latest version) doesn't work with lottie-react at all, even with version 2.4.1. It fails during deployment as below.
Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
ReferenceError: document is not defined
at createTag (/vercel/path0/.next/server/app/page.js:27:173898)
@ronaldaug You can use a next/dynamic import to make sure the lottie-react is not server rendered;
import dynamic from 'next/dynamic';
const LottieReact = dynamic(() => import('lottie-react'), {ssr: false});
@ronaldaug You can use a
next/dynamicimport to make sure thelottie-reactis not server rendered;import dynamic from 'next/dynamic';
const LottieReact = dynamic(() => import('lottie-react'), {ssr: false});
This way, when the page is first loaded, it is hidden, but it works