Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Initializing Flowise Data Source Due to ES Module Import Incompatibility on Windows #1768

Closed
gerotutu opened this issue Feb 20, 2024 · 2 comments

Comments

@gerotutu
Copy link

Describe the bug
After installing Flowise globally using npm and attempting to start it, multiple deprecated warnings are shown, and the server fails to start due to an error related to the incompatibility of importing an ES Module using require() in a CommonJS module. Specifically, the error is thrown when @qdrant/openapi-typescript-fetch attempts to require() the json-with-bigint module, which is an ES Module.

To Reproduce
Steps to reproduce the behavior:

  1. Open the terminal.
  2. Navigate to your project directory using cd C:\Users\Admin\Projects.
  3. Install Flowise globally with npm install -g flowise.
  4. Start Flowise with npx flowise start.
  5. Observe the deprecated warnings and the error message indicating a failure in Data Source initialization due to an ES Module import issue.

Expected behavior
Flowise should start without any errors, and the server should be listening on port 3000 with the Data Source initialized successfully.

Terminal

PS C:\Users\Admin\Projects> npm install -g flowise
npm WARN ERESOLVE overriding peer dependency
npm WARN deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
npm WARN deprecated @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead.
npm WARN deprecated @oclif/[email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated [email protected]: Use your platform's native atob() and btoa() methods instead
npm WARN deprecated [email protected]: Use your platform's native DOMException instead
npm WARN deprecated [email protected]: Use mz or fs-extra^3.0 with Promise Support
npm WARN deprecated [email protected]: cross-spawn no longer requires a build toolchain, use it instead
npm WARN deprecated [email protected]: The library contains critical security issues and should not be used for production! The maintenance of the project has been discontinued. Consider migrating your code to isolated-vm.
npm WARN deprecated [email protected]: < 21.5.0 is no longer supported
npm WARN deprecated [email protected]: < 21.5.0 is no longer supported
npm WARN deprecated [email protected]: Version no longer supported. Upgrade to @latest

changed 1892 packages in 5m

290 packages are looking for funding
  run `npm fund` for details
PS C:\Users\Admin\Projects> npx flowise start
2024-02-20 10:54:41 [INFO]: Starting Flowise...
2024-02-20 10:54:41 [INFO]: ⚡️ [server]: Flowise Server is listening at 3000
2024-02-20 10:54:41 [INFO]: 📦 [server]: Data Source has been initialized!
2024-02-20 10:54:44 [ERROR]: ❌ [server]: Error during Data Source initialization: require() of ES Module C:\Users\Admin\AppData\Roaming\npm\node_modules\flowise\node_modules\json-with-bigint\json-with-bigint.js from C:\Users\Admin\AppData\Roaming\npm\node_modules\flowise\node_modules\@qdrant\openapi-typescript-fetch\dist\cjs\fetcher.js not supported.
Instead change the require of json-with-bigint.js in C:\Users\Admin\AppData\Roaming\npm\node_modules\flowise\node_modules\@qdrant\openapi-typescript-fetch\dist\cjs\fetcher.js to a dynamic import() which is available in all CommonJS modules.Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Users\Admin\AppData\Roaming\npm\node_modules\flowise\node_modules\json-with-bigint\json-with-bigint.js from C:\Users\Admin\AppData\Roaming\npm\node_modules\flowise\node_modules\@qdrant\openapi-typescript-fetch\dist\cjs\fetcher.js not supported.
Instead change the require of json-with-bigint.js in C:\Users\Admin\AppData\Roaming\npm\node_modules\flowise\node_modules\@qdrant\openapi-typescript-fetch\dist\cjs\fetcher.js to a dynamic import() which is available in all CommonJS modules.    at Object.<anonymous> (C:\Users\Admin\AppData\Roaming\npm\node_modules\flowise\node_modules\@qdrant\openapi-typescript-fetch\dist\cjs\fetcher.js:5:28)
    at Object.<anonymous> (C:\Users\Admin\AppData\Roaming\npm\node_modules\flowise\node_modules\@qdrant\openapi-typescript-fetch\dist\cjs\index.js:4:22)
    at Object.<anonymous> (C:\Users\Admin\AppData\Roaming\npm\node_modules\flowise\node_modules\@qdrant\js-client-rest\dist\cjs\api-client.js:4:36)
    at Object.<anonymous> (C:\Users\Admin\AppData\Roaming\npm\node_modules\flowise\node_modules\@qdrant\js-client-rest\dist\cjs\qdrant-client.js:5:25)
    at Object.<anonymous> (C:\Users\Admin\AppData\Roaming\npm\node_modules\flowise\node_modules\@qdrant\js-client-rest\dist\cjs\index.js:18:26)
    at Object.<anonymous> (C:\Users\Admin\AppData\Roaming\npm\node_modules\flowise\node_modules\flowise-components\dist\nodes\vectorstores\Qdrant\Qdrant.js:4:26)
    at C:\Users\Admin\AppData\Roaming\npm\node_modules\flowise\dist\NodesPool.js:32:42
    at Array.map (<anonymous>)
    at NodesPool.initializeNodes (C:\Users\Admin\AppData\Roaming\npm\node_modules\flowise\dist\NodesPool.js:30:38)
    at async NodesPool.initialize (C:\Users\Admin\AppData\Roaming\npm\node_modules\flowise\dist\NodesPool.js:20:9)
    at async C:\Users\Admin\AppData\Roaming\npm\node_modules\flowise\dist\index.js:78:13

Setup

  • Installation: Installed globally using npm install -g flowise.
  • OS: Windows 11 Pro

Additional context

  • Node.js versions tried: v18.19.1 and v20.11.1.
  • The issue seems to be related to a known limitation with require() in CommonJS modules when attempting to import ES Modules, suggesting a potential incompatibility or outdated dependency within the Flowise package.
@WilliWespe
Copy link

I could solve this problem for me, and also this: #1766 , by:

  • deleting my .flowise directory
  • globally uninstalling flowise npm uninstall -g flowise
  • gloablly reinstalling the newest version npm install -g flowise
  • updating these dependencies npm update @qdrant/openapi-typescript-fetch json-with-bigint

I can't gurantee that it will work for you. But in my case I could add credentials, and the program didn't crash. I could successfully run a chatflow.

I installed the newest flowise version, and my Node.js version is 20.9.0

@HenryHengZJ
Copy link
Contributor

HenryHengZJ commented Feb 20, 2024

Just launched a new version 1.5.1, issue should be fixed with this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants