ai16z / eliza

Conversational Agent for Twitter and Discord
https://ai16z.github.io/eliza/
MIT License
908 stars 255 forks source link

TypeError: Promise.withResolvers is not a function #76

Closed sirkitree closed 2 weeks ago

sirkitree commented 2 weeks ago

From an off comment in https://github.com/ai16z/eliza/issues/47#issuecomment-2443482858 from https://github.com/adnanmirza1

Describe the bug

Hello @sirkitree, hope you'll be fine. Sorry for being off the topic but I need help setting up this project on my linux machine, I added env's, node v 20.13.1, runned npm i which was successful, and now after node --loader ts-node/esm src/index.ts I'm seeing below error. image

sirkitree commented 2 weeks ago

@adnanmirza1 can you please add step to reproduce this bug reliably?

sirkitree commented 2 weeks ago

I'm now experiencing this.

This error occurs because Promise.withResolvers() is a relatively new feature that isn't available in Node.js v20.18.0.

We have a few options to fix this:

  1. Upgrade to Node.js v21.0.0 or later where Promise.withResolvers() is supported
  2. Use an older version of pdfjs-dist that doesn't use this feature. You can modify your package.json
  3. Create a polyfill for Promise.withResolvers(). You would need to add this before importing pdfjs-dist

I think we should go with option 1.

sirkitree commented 2 weeks ago

Tested this PR and it works - do you want to give it a shot @adnanmirza1 ?

adnanmirza1 commented 2 weeks ago

thanks @sirkitree, I just cloned it followed the steps from readme, installed the packages using npm i, (node version 20.13.1). After this I started the project using command npm run start and got this Promise.withResolvers error. I did some search and added polyfill and the issue was solved using the guides from issue https://github.com/wojtekmaj/react-pdf/issues/1811

then after some time I simply updated the node version to 22.10.0 using nvm and the issue was solved even without the polyfill.