Skip to content

Error "Please install hnswlib-node as a dependency with, e.g. npm install -S hnswlib-node" on M2 Chip #90

@clemenspeters

Description

@clemenspeters

While the exact same docker image builds just fine on the linux AWS EC2 servers and in github actions, on my M2 Chip MacBook I get

#0 14.81 file:///app/node_modules/langchain/dist/vectorstores/hnswlib.js:172
#0 14.81             throw new Error("Please install hnswlib-node as a dependency with, e.g. `npm install -S hnswlib-node`");
#0 14.81                   ^
#0 14.81 
#0 14.81 Error: Please install hnswlib-node as a dependency with, e.g. `npm install -S hnswlib-node`
#0 14.81     at HNSWLib.imports (file:///app/node_modules/langchain/dist/vectorstores/hnswlib.js:172:19)
#0 14.81     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
#0 14.81     at async HNSWLib.getHierarchicalNSW (file:///app/node_modules/langchain/dist/vectorstores/hnswlib.js:35:37)
#0 14.81     at async HNSWLib.initIndex (file:///app/node_modules/langchain/dist/vectorstores/hnswlib.js:49:26)
#0 14.81     at async HNSWLib.addVectors (file:///app/node_modules/langchain/dist/vectorstores/hnswlib.js:68:9)
#0 14.81     at async HNSWLib.fromDocuments (file:///app/node_modules/langchain/dist/vectorstores/hnswlib.js:163:9)

when running HNSWLib.fromDocuments(docs, new OpenAIEmbeddings({...embeddingsOpts, openAIApiKey:OPENAI_API_KEY})); is called.

So it works on the server (luckily), but not on my local machine in docker 🤔 😕

Dockerfile:

FROM node:18-alpine AS BUILD_IMAGE

RUN apk update && \
    apk add -q make g++ python3
.
.
.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions