Helmet
Helmet14mo ago

Could not locate the bindings file

I'm using HNSWLib-node for a vectorstore, but when I run npx convex dev, I get
400 Bad Request: InvalidModules: Hit an error while pushing:
Loading the pushed modules encountered the following
error:
Uncaught Failed to analyze _deps/node/EWAOYEO5.js: Could not locate the bindings file. Tried:
→ /tmp/source/e9f38876-a6ef-41e1-b3c9-c5d51185bdcc/build/addon.node
→ /tmp/source/e9f38876-a6ef-41e1-b3c9-c5d51185bdcc/build/Debug/addon.node
→ /tmp/source/e9f38876-a6ef-41e1-b3c9-c5d51185bdcc/build/Release/addon.node
→ /tmp/source/e9f38876-a6ef-41e1-b3c9-c5d51185bdcc/out/Debug/addon.node
→ /tmp/source/e9f38876-a6ef-41e1-b3c9-c5d51185bdcc/Debug/addon.node
→ /tmp/source/e9f38876-a6ef-41e1-b3c9-c5d51185bdcc/out/Release/addon.node

at bindings (../../../node_modules/bindings/bindings.js:126:4)
at node_modules/hnswlib-node/lib/index.js (../../../node_modules/hnswlib-node/lib/index.js:19:17)
at __require2 (convex:/user/_deps/node/R44RVPLZ.js:16:50)
at <anonymous> (../../../node_modules/hnswlib-node/lib/index.js:19:17)
400 Bad Request: InvalidModules: Hit an error while pushing:
Loading the pushed modules encountered the following
error:
Uncaught Failed to analyze _deps/node/EWAOYEO5.js: Could not locate the bindings file. Tried:
→ /tmp/source/e9f38876-a6ef-41e1-b3c9-c5d51185bdcc/build/addon.node
→ /tmp/source/e9f38876-a6ef-41e1-b3c9-c5d51185bdcc/build/Debug/addon.node
→ /tmp/source/e9f38876-a6ef-41e1-b3c9-c5d51185bdcc/build/Release/addon.node
→ /tmp/source/e9f38876-a6ef-41e1-b3c9-c5d51185bdcc/out/Debug/addon.node
→ /tmp/source/e9f38876-a6ef-41e1-b3c9-c5d51185bdcc/Debug/addon.node
→ /tmp/source/e9f38876-a6ef-41e1-b3c9-c5d51185bdcc/out/Release/addon.node

at bindings (../../../node_modules/bindings/bindings.js:126:4)
at node_modules/hnswlib-node/lib/index.js (../../../node_modules/hnswlib-node/lib/index.js:19:17)
at __require2 (convex:/user/_deps/node/R44RVPLZ.js:16:50)
at <anonymous> (../../../node_modules/hnswlib-node/lib/index.js:19:17)
I am not sure the exact cause of this error as I have run the exact same file locally with no issues. I am following Langchain's usage instructions, and as it runs locally, I can only assume this issue is related to Convex not having some sort of support for bindings and node addons. I'd appreciate some help resolving this issue.
10 Replies
Michal Srb
Michal Srb14mo ago
Hey @Helmet, can you try with externalPackages config? https://docs.convex.dev/functions/bundling#external-packages
Bundling | Convex Developer Hub
Bundling is the process of gathering, optimizing and transpiling the JS/TS
Helmet
HelmetOP14mo ago
@Michal Srb Throwing a new error
npm ERR! code 1
npm ERR! path /tmp/build_deps/node_modules/hnswlib-node
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.4.0
npm ERR! gyp info using node@18.18.0 | linux | arm64
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! find Python Python is not set from command line or npm configuration
npm ERR! gyp ERR! find Python Python is not set from environment variable PYTHON
npm ERR! gyp ERR! find Python checking if "python3" can be used
npm ERR! gyp ERR! find Python - "python3" is not in PATH or produced an error
npm ERR! gyp ERR! find Python checking if "python" can be used
npm ERR! gyp ERR! find Python - "python" is not in PATH or produced an error
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! find Python **********************************************************
npm ERR! gyp ERR! find Python You need to install the latest version of Python.
npm ERR! gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
npm ERR! gyp ERR! find Python you can try one of the following options:
npm ERR! gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
npm ERR! gyp ERR! find Python (accepted by both node-gyp and npm)
npm ERR! gyp ERR! find Python - Set the environment variable PYTHON
npm ERR! gyp ERR! find Python - Set the npm configuration variable python:
npm ERR! gyp ERR! find Python npm config set python "/path/to/pythonexecutable"
npm ERR! gyp ERR! find Python For more information consult the documentation at:
npm ERR! gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Python installation to use
npm ERR! gyp ERR! cwd /tmp/build_deps/node_modules/hnswlib-node
npm ERR! gyp ERR! node -v v18.18.0
npm ERR! gyp ERR! node-gyp -v v9.4.0
npm ERR! gyp ERR! not ok
npm ERR! code 1
npm ERR! path /tmp/build_deps/node_modules/hnswlib-node
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.4.0
npm ERR! gyp info using node@18.18.0 | linux | arm64
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! find Python Python is not set from command line or npm configuration
npm ERR! gyp ERR! find Python Python is not set from environment variable PYTHON
npm ERR! gyp ERR! find Python checking if "python3" can be used
npm ERR! gyp ERR! find Python - "python3" is not in PATH or produced an error
npm ERR! gyp ERR! find Python checking if "python" can be used
npm ERR! gyp ERR! find Python - "python" is not in PATH or produced an error
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! find Python **********************************************************
npm ERR! gyp ERR! find Python You need to install the latest version of Python.
npm ERR! gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
npm ERR! gyp ERR! find Python you can try one of the following options:
npm ERR! gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
npm ERR! gyp ERR! find Python (accepted by both node-gyp and npm)
npm ERR! gyp ERR! find Python - Set the environment variable PYTHON
npm ERR! gyp ERR! find Python - Set the npm configuration variable python:
npm ERR! gyp ERR! find Python npm config set python "/path/to/pythonexecutable"
npm ERR! gyp ERR! find Python For more information consult the documentation at:
npm ERR! gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Python installation to use
npm ERR! gyp ERR! cwd /tmp/build_deps/node_modules/hnswlib-node
npm ERR! gyp ERR! node -v v18.18.0
npm ERR! gyp ERR! node-gyp -v v9.4.0
npm ERR! gyp ERR! not ok
Something related to node-gyp which is used to build bindings, and python not being found Does convex have python installed in the environment, or is this related to my local environment? I have python3 installed in my local environment so I don't think it's that
Michal Srb
Michal Srb14mo ago
I don't think Convex's Node environment will have Python installed, so I don't think this vector store will work.
Helmet
HelmetOP14mo ago
Alright, I'll probably just use the ConvexVectorstore instead Do you know if there's any way to get python installed, or is that perhaps a future improvement?
Michal Srb
Michal Srb14mo ago
I think we might one day run Python as an alternative offering next to JS, but we're very far off from it. Not sure about Python being available for Node.js packages.
ian
ian14mo ago
One thing that worked for me when I ran into this was to set the external packages config to: "externalPackages": ["langchain"] My guess as to why it helps is that it's excluding some python-dependent package which successfully bundles client-side
Helmet
HelmetOP14mo ago
I tried the langchain as the external package but it still gave the same error. I ended up switching to Convex's langchain wrapper for vector store and that works perfectly for my needs.
tiernacity
tiernacity10mo ago
I've just bumped up against the same issue (node-gyp wants python) while trying to install https://github.com/Automattic/node-canvas with "externalPackages": ["*"]
GitHub
GitHub - Automattic/node-canvas: Node canvas is a Cairo backed Canv...
Node canvas is a Cairo backed Canvas implementation for NodeJS. - Automattic/node-canvas
Michal Srb
Michal Srb10mo ago
@tiernacity Convex's runtimes don't have python available, you might need to fork that library and remove the python requirement.
tiernacity
tiernacity10mo ago
Yeah, in fact I spent a while trying out @napi-rs/canvas which has no such dependencies, but couldn't get that to work either (for different reasons). Eventually I decided to give up, and just consume what I need via a third-party API

Did you find this page helpful?