Error starting N8N with my custom AI Vector Store Node

Description of the problem/error/question

I have made Qdrant node from pinecone node. I followed most of the steps in guide. I have succesfully linted and built my node. Than I linked it to ~/.n8n/custom. But nothing works
I tried copying folders like ‘utils’ and ‘shared’ into my node dir so dependencies are solved. Than I tried to move all files into my node/NodeName dir. So that did not change anything either.

Source code is available at github

Error message

When I “n8n start” there’s next message:

C:\Users\Lanity\.n8n\custom>n8n start
Initializing n8n process
Error loading node "gonzales" from: "C:/Users/Lanity/.n8n/custom/node_modules/n8n-nodes-qdrant/node_modules/csso/lib/gonzales.cssp.node.js" - require(...).gonzales is not a constructor
evalmachine.<anonymous>:1
new (require('C:/Users/Lanity/.n8n/custom/node_modules/n8n-nodes-qdrant/node_modules/csso/lib/gonzales.cssp.node.js').gonzales)()
^

TypeError: require(...).gonzales is not a constructor
    at evalmachine.<anonymous>:1:1
    at Script.runInContext (node:vm:134:12)
    at loadClassInIsolation (C:\Users\Lanity\AppData\Roaming\nvm\v18.19.0\node_modules\n8n\node_modules\n8n-core\src\ClassLoader.ts:9:16)
    at CustomDirectoryLoader.loadNodeFromFile (C:\Users\Lanity\AppData\Roaming\nvm\v18.19.0\node_modules\n8n\node_modules\n8n-core\src\DirectoryLoader.ts:83:35)
    at CustomDirectoryLoader.loadAll (C:\Users\Lanity\AppData\Roaming\nvm\v18.19.0\node_modules\n8n\node_modules\n8n-core\src\DirectoryLoader.ts:304:9)
    at LoadNodesAndCredentials.runDirectoryLoader (C:\Users\Lanity\AppData\Roaming\nvm\v18.19.0\node_modules\n8n\src\LoadNodesAndCredentials.ts:257:3)
    at LoadNodesAndCredentials.loadNodesFromCustomDirectories (C:\Users\Lanity\AppData\Roaming\nvm\v18.19.0\node_modules\n8n\src\LoadNodesAndCredentials.ts:175:4)
    at LoadNodesAndCredentials.init (C:\Users\Lanity\AppData\Roaming\nvm\v18.19.0\node_modules\n8n\src\LoadNodesAndCredentials.ts:94:3)
    at Start.init (C:\Users\Lanity\AppData\Roaming\nvm\v18.19.0\node_modules\n8n\src\commands\BaseCommand.ts:52:3)
    at Start.init (C:\Users\Lanity\AppData\Roaming\nvm\v18.19.0\node_modules\n8n\src\commands\start.ts:209:3)
Error: Exiting due to an error.
TypeError: require(...).gonzales is not a constructor

Before that there was another similar error which was mostly like this but “require(…).isomorphic is not a constructor”. That error was solved by adding isomorphic npm package to node packahe

Main question

I do not have lots of experience in JS. So
My question is what could be wrong? Where I should look for solutions?

Information on system and setup

node 18.19.0
npm 10.2.3

n8n-nodes-langchain 0.6.0

  • n8n version: 1.21.0
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): Do not start)
  • Running n8n via (Docker, npm, n8n cloud, desktop app): npm
  • Operating system: Windows 11

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hey @mr-good-bye,

Welcome to the community :cake:

There are some issues in your package.json

"dependencies": {
    "@gxl/epub-parser": "^2.0.4",
    "@n8n/n8n-nodes-langchain": "^0.6.0",
    "@qdrant/js-client-rest": "^1.7.0",
    "gonzales": "^1.0.7",
    "gonzales-pe": "^4.3.0",
    "isomorphic": "^0.0.11",
    "langchain": "^0.0.203",
    "n8n": "^1.21.0"
  }

You should only include the dependencies that your node needs so changes are it won’t need n8n, n8n-nodes-langchain or langchain as we already use those so you could make them dev dependencies instead.

It then looks like there could be an issue loading gonzales sadly I am not familiar with that package but looking at the docs for it gonzales-pe seems to be a replacement for it so you may not need to include that either.

Such thing is - I don’t use gonzales in my node, I can’t explain why, when and how it appears to be a dependency

Did you maybe run npm i gonzales or something?

Yeah! I tried to resolve “gonzales not a constructor” like I resolved “isomorphic not a constructor”. Now I am removing gonzales and isomorphic, because it is packages I did not use, than I will try running again and share results. Just in 5 minutes

C:\Users\Lanity\.n8n\custom>n8n start
Initializing n8n process
Error loading node "isomorphic" from: "C:/Users/Lanity/.n8n/custom/node_modules/n8n-nodes-qdrant/node_modules/@jsdevtools/ono/cjs/isomorphic.node.js" - require(...).isomorphic is not a constructor
evalmachine.<anonymous>:1
new (require('C:/Users/Lanity/.n8n/custom/node_modules/n8n-nodes-qdrant/node_modules/@jsdevtools/ono/cjs/isomorphic.node.js').isomorphic)()
^

TypeError: require(...).isomorphic is not a constructor
    at evalmachine.<anonymous>:1:1
    at Script.runInContext (node:vm:134:12)
    at loadClassInIsolation (C:\Users\Lanity\AppData\Roaming\nvm\v18.19.0\node_modules\n8n\node_modules\n8n-core\src\ClassLoader.ts:9:16)
    at CustomDirectoryLoader.loadNodeFromFile (C:\Users\Lanity\AppData\Roaming\nvm\v18.19.0\node_modules\n8n\node_modules\n8n-core\src\DirectoryLoader.ts:83:35)
    at CustomDirectoryLoader.loadAll (C:\Users\Lanity\AppData\Roaming\nvm\v18.19.0\node_modules\n8n\node_modules\n8n-core\src\DirectoryLoader.ts:304:9)
    at LoadNodesAndCredentials.runDirectoryLoader (C:\Users\Lanity\AppData\Roaming\nvm\v18.19.0\node_modules\n8n\src\LoadNodesAndCredentials.ts:257:3)
    at LoadNodesAndCredentials.loadNodesFromCustomDirectories (C:\Users\Lanity\AppData\Roaming\nvm\v18.19.0\node_modules\n8n\src\LoadNodesAndCredentials.ts:175:4)
    at LoadNodesAndCredentials.init (C:\Users\Lanity\AppData\Roaming\nvm\v18.19.0\node_modules\n8n\src\LoadNodesAndCredentials.ts:94:3)
    at Start.init (C:\Users\Lanity\AppData\Roaming\nvm\v18.19.0\node_modules\n8n\src\commands\BaseCommand.ts:52:3)
    at Start.init (C:\Users\Lanity\AppData\Roaming\nvm\v18.19.0\node_modules\n8n\src\commands\start.ts:209:3)
Error: Exiting due to an error.
TypeError: require(...).isomorphic is not a constructor

This is what I get without isomorphic and gonzales in dependencies and it is what I started with after I’ve built my node first time. If I add isomorphic package there is problem with gonzales not a constructor. Can you maybe point out some community-nodes which use n8n-nodes-langchain and n8n@ai-beta where I can look for a solution?

Hey @mr-good-bye,

That looks like there is still a project issue of some kind, There are 2 community nodes that build on top of the langchain options the second one does have the source available.

Are updates for langchain nodes in plan? Will there be qdrant integration? Maybe I can somehow try to add my node to official n8n-nodes-langchain package?

Hey there. We at Qdrant are planning to build an N8N integration. Will update you on how that goes.

2 Likes

A PR is up to add Qdrant as a supported vectorstore.

4 Likes

To close the loop on this one this was release in 1.23.0, Thanks for the work you did on this @Anush

2 Likes

That’s great. Already tried that today. Big thanks, @Anush.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.