friday / lottie-node

Export lottie animations in Node.js
MIT License
56 stars 11 forks source link

"Cannot read property 'loadAnimation' of undefined" running render-snapshot.js example #23

Open meo85 opened 2 years ago

meo85 commented 2 years ago

Expected behavior

render-snapshot.js runs correctly

Actual behavior

script fails on window.lottie.loadAnimation with this error:

UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'loadAnimation' of undefined at /Users/meo/node_modules/lottie-node/index.js:63:24 at /Users/meo/Downloads/render-snapshot.js:11:21

which means that eval didn't create lottie object

Steps to reproduce

node render-snapshot.js test.json test.png

Environment

Tried also on an Azure Function with linux and Node 12.22.11 (different version of jsdom too, 19.0.0) and reported exaxtly the same error

Full stack trace or any errors

(node:55203) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'loadAnimation' of undefined at /Users/meo/node_modules/lottie-node/index.js:63:24 at /Users/meo/Downloads/render-snapshot.js:11:21 (Use node --trace-warnings ... to show where the warning was created) (node:55203) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:55203) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Link to where the bug is happening

render-snapshot.js

PisChiao commented 1 year ago

i have the same problem,any solve?