microsoft / TypeChat

TypeChat is a library that makes it easy to build natural language interfaces using types.
https://microsoft.github.io/TypeChat/
MIT License
8.16k stars 390 forks source link

Cannot find module 'readline/promises' error in production #131

Closed vyktoremario closed 10 months ago

vyktoremario commented 11 months ago

I was using Typechat in a project I worked on and it worked fine during development, The deployed version was raising the following error from that library: Cannot find module 'readline/promises',

Could it be that it's not bundled properly, or doesn't work in a lambda environment for some reason?

I need some help here.

SweetpopcornSimon commented 11 months ago

Hey!

What version of node are you using?

vyktoremario commented 11 months ago

Hi @SweetpopcornSimon I am using version ^18.13.0 of node

SweetpopcornSimon commented 11 months ago

Okay I had that problem and the issue was I didn't have the right node or typescript version, I upgraded node to 18.17.1 and my package.json looks like this "devDependencies": { "@types/node": "^20.3.1", "copyfiles": "^2.4.1", "typescript": "^5.1.3" }

This thread helped me find the issue https://github.com/TypeStrong/ts-node/discussions/1638

vyktoremario commented 11 months ago

@SweetpopcornSimon thanks for the response. I will try this out and let you know if it works

SweetpopcornSimon commented 11 months ago

@vyktoremario did it work?

vyktoremario commented 11 months ago

@SweetpopcornSimon It did not work. We had to disable it for now as it was blocking some features from going live.

DanielRosenwasser commented 10 months ago

It sounds like this was an issue with the target runtime. I believe if you use Node 20 or later, you should have no issues here.

venkateshpotluri commented 10 months ago

My project uses react-scripts and is running on node V20 but I still see this error.