vercel / modelfusion

The TypeScript library for building AI applications.
https://modelfusion.dev
MIT License
1.06k stars 76 forks source link

Cannot find module Zodschema imported from invokeFlow.js #174

Closed fcam77 closed 8 months ago

fcam77 commented 8 months ago

Hi Lars,

Thanks again for the great work you're doing around Modelfusion.

Was wondering if you can give me any hints on what may be causing this error below? I'm using modelfusion as part of a Nuxt 3 application. This error keeps happening.

I've verified that Zodschema.js file is present and accessible. I've redone node_modules and npm install.

500 Cannot find module '/Users/fredcamacho/dev/hcgps/node_modules/modelfusion/core/structure/ZodSchema' imported from /Users/fredcamacho/dev/hcgps/node_modules/modelfusion/browser/invokeFlow.js

at new NodeError (node:internal/errors:405:5) at finalizeResolution (node:internal/modules/esm/resolve:324:11) at moduleResolve (node:internal/modules/esm/resolve:943:10) at defaultResolve (node:internal/modules/esm/resolve:1129:11) at nextResolve (node:internal/modules/esm/loader:163:28) at ESMLoader.resolve (node:internal/modules/esm/loader:835:30) at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18) at ModuleWrap. (node:internal/modules/esm/module_job:77:40) at link (node:internal/modules/esm/module_job:76:36)

Thanks for your help!

Fred

nanotronic commented 8 months ago

Could it be that you are using node 21? If so try to downgrade to version 20.

lgrammel commented 8 months ago

@fcam77 Thanks for the bug report! I've fixed the imports in invokeFlow, please give v0.68.1 a try. If the fix does not solve it, please re-open the issue.

lgrammel commented 8 months ago

@nanotronic have you observed any issues with node 21 & modelfusion? I'm still on Node 20 so that would be good to know

nanotronic commented 8 months ago

Yes, but it seems related to pdfjs. When I try to run the pdf-chat-terminal example with node 21 I am getting:

webpack://pdfjs-dist/build/pdf/src/shared/util.js:638
      isWin: navigator.platform.includes("Win")

With node 20 it works flawlessly.

lgrammel commented 8 months ago

Yes, but it seems related to pdfjs. When I try to run the pdf-chat-terminal example with node 21 I am getting:

webpack://pdfjs-dist/build/pdf/src/shared/util.js:638
      isWin: navigator.platform.includes("Win")

With node 20 it works flawlessly.

@nanotronic oh yeah, pdfjs is quite difficult in that regard. That's why I have not included it as a tool in ModelFusion, but kept it separate. It breaks in many environments.

fcam77 commented 8 months ago

@fcam77 Thanks for the bug report! I've fixed the imports in invokeFlow, please give v0.68.1 a try. If the fix does not solve it, please re-open the issue.

Thanks @lgrammel for the quick turnaround - that seems to have fixed it!