Giter Club home page Giter Club logo

faiss-node's Introduction

Hi there πŸ‘‹

faiss-node's People

Contributors

asilvas avatar ewfian avatar neebdev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

faiss-node's Issues

Using Faiss-node in aws having problem working fine locally

Describe the bug
A clear and concise description of what the bug is.

Environment:

  • Operating system: [e.g. Windows x64]
  • Nodejs Version: [e.g. v18.15.0]
  • Package Version: [e.g. v0.1.0]

To Reproduce
Steps to reproduce the behavior:
1.
2.

Expected behavior
should be run succesfully and store text in form of vector store

Screenshots
"errorType": "Error",
"errorMessage": "Could not import faiss-node. Please install faiss-node as a dependency with, e.g. npm install -S faiss-node and make sure you have libomp installed in your path.\n\nError: /opt/nodejs/node18/node_modules/faiss-node/build/Release/faiss-node.node: cannot open shared object file: No such file or directory",
"trace": [
"Error: Could not import faiss-node. Please install faiss-node as a dependency with, e.g. npm install -S faiss-node and make sure you have libomp installed in your path.",
"",
"Error: /opt/nodejs/node18/node_modules/faiss-node/build/Release/faiss-node.node: cannot open shared object file: No such file or directory",
" at FaissStore.importFaiss (file:///opt/nodejs/node18/node_modules/langchain/dist/vectorstores/faiss.js:207:19)",
" at process.processTicksAndRejections (node:internal/process/task_queues:95:5)",
" at async FaissStore.addVectors (file:///opt/nodejs/node18/node_modules/langchain/dist/vectorstores/faiss.js:60:37)",
" at async FaissStore.fromDocuments (file:///opt/nodejs/node18/node_modules/langchain/dist/vectorstores/faiss.js:197:9)",
" at async Runtime.handler (file:///var/task/index.mjs:57:19)"
]
}

.

Docker Installation Failed

Describe the bug
When installing on Docker, following issue exists:

404 https://github.com/ewfian/faiss-node/releases/download/v0.2.0/faiss-node-v0.2.0-napi-v8-linuxmusl-x64.tar.gz

Seems like the library doesn't support linuxmusl? As I couldnt find the tar.gz file in releases

Environment:

  • Operating system: Docker node:18-alpine
  • Package Version: [e.g. v0.2.0]

To Reproduce
Steps to reproduce the behavior:

  1. Init a project with faiss-node installed
  2. Build a docker image on the project

Expected behavior
Works fine

Screenshots
image

Install failed

.pnpm/[email protected]/node_modules/faiss-node: Running install script, failed in 7s
.../node_modules/faiss-node install$ prebuild-install --runtime napi --verbose || (npm i cmake-js && npm run build)
β”‚ prebuild-install info begin Prebuild-install version 7.1.1
β”‚ prebuild-install info looking for local prebuild @ prebuilds\faiss-node-v0.2.2-napi-v8-win32-x64.tar.gz
β”‚ prebuild-install info looking for cached prebuild @ C:\Users\Administrator\AppData\Roaming\npm-cache\_prebuilds\177…
β”‚ prebuild-install http request GET https://github.com/ewfian/faiss-node/releases/download/v0.2.2/faiss-node-v0.2.2-n…
β”‚ prebuild-install warn install unable to verify the first certificate
β”‚ changed 70 packages in 1s
β”‚ > [email protected] build
β”‚ > cmake-js compile
β”‚ info find VS using VS2022 (17.6.33815.320) found at:
β”‚ info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools"
β”‚ info find VS run with --verbose for detailed information
β”‚ info TOOL Using Visual Studio 17 2022 generator.
β”‚ info CMD BUILD
β”‚ info RUN [
β”‚ info RUN   'cmake',
β”‚ info RUN   '--build',
β”‚ info RUN   'D:\\pnpm_repo\\global\\5\\.pnpm\\[email protected]\\node_modules\\faiss-node\\build',
β”‚ info RUN   '--config',
β”‚ info RUN   'Release'
β”‚ info RUN ]
β”‚ MSBuild version 17.6.3+07e294721 for .NET Framework
β”‚ MSBUILD : error MSB1009: οΏ½οΏ½ΔΏοΏ½ΔΌοΏ½οΏ½οΏ½οΏ½οΏ½οΏ½Ϊ‘οΏ½
β”‚ οΏ½οΏ½οΏ½οΏ½:ALL_BUILD.vcxproj
β”‚ info REP Build has been failed, trying to do a full rebuild.
β”‚ info CMD CLEAN
β”‚ info RUN [
β”‚ info RUN   'cmake',
β”‚ info RUN   '-E',
β”‚ info RUN   'remove_directory',
β”‚ info RUN   'D:\\pnpm_repo\\global\\5\\.pnpm\\[email protected]\\node_modules\\faiss-node\\build'
β”‚ info RUN ]
β”‚ info CMD CONFIGURE
β”‚ info find VS using VS2022 (17.6.33815.320) found at:
β”‚ info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools"
β”‚ info find VS run with --verbose for detailed information
β”‚ info RUN [
β”‚ info RUN   'cmake',
β”‚ info RUN   'D:\\pnpm_repo\\global\\5\\.pnpm\\[email protected]\\node_modules\\faiss-node',
β”‚ info RUN   '--no-warn-unused-cli',
β”‚ info RUN   '-G',
β”‚ info RUN   'Visual Studio 17 2022',
β”‚ info RUN   '-A',
β”‚ info RUN   'x64',
β”‚ info RUN   '-DCMAKE_JS_VERSION=7.2.1',
β”‚ info RUN   '-DCMAKE_BUILD_TYPE=Release',
β”‚ info RUN   '-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=D:\\pnpm_repo\\global\\5\\.pnpm\\[email protected]\\node_modules\\faiss…
β”‚ info RUN   '-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$<CONFIG:Debug>:Debug>',
β”‚ info RUN   '-DCMAKE_JS_INC=C:\\Users\\Administrator\\AppData\\Roaming\\npm\\node_modules\\cmake-js\\node_modules\\n…
β”‚ info RUN   '-DCMAKE_JS_SRC=C:/Users/Administrator/AppData/Roaming/npm/node_modules/cmake-js/lib/cpp/win_delay_load_…
β”‚ info RUN   '-DNODE_RUNTIME=node',
β”‚ info RUN   '-DNODE_RUNTIMEVERSION=18.16.1',
β”‚ info RUN   '-DNODE_ARCH=x64',
β”‚ info RUN   '-DCMAKE_JS_LIB=D:\\pnpm_repo\\global\\5\\.pnpm\\[email protected]\\node_modules\\faiss-node\\build\\node…
β”‚ info RUN   '-DCMAKE_JS_NODELIB_DEF=D:\\pnpm_repo\\global\\5\\.pnpm\\[email protected]\\node_modules\\faiss-node\\bui…
β”‚ info RUN   '-DCMAKE_JS_NODELIB_TARGET=D:\\pnpm_repo\\global\\5\\.pnpm\\[email protected]\\node_modules\\faiss-node\\…
β”‚ info RUN   '-DCMAKE_SHARED_LINKER_FLAGS=/DELAYLOAD:NODE.EXE'
β”‚ info RUN ]
β”‚ Not searching for unused variables given on the command line.
β”‚ -- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.22621.
β”‚ -- The CXX compiler identification is MSVC 19.36.32535.0
β”‚ -- Detecting CXX compiler ABI info
β”‚ -- Detecting CXX compiler ABI info - done
β”‚ -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.…
β”‚ -- Detecting CXX compile features
β”‚ -- Detecting CXX compile features - done
β”‚ CMake Error at CMakeLists.txt:51 (add_subdirectory):
β”‚   add_subdirectory given source "deps/faiss" which is not an existing
β”‚   directory.
β”‚ CMake Error at CMakeLists.txt:52 (set_target_properties):
β”‚   set_target_properties Can not find target to add properties to: faiss
β”‚ Microsoft (R) Library Manager Version 14.36.32535.0
β”‚ Copyright (C) Microsoft Corporation.  All rights reserved.
β”‚   ζ­£εœ¨εˆ›ε»ΊεΊ“ D:\pnpm_repo\global\5\.pnpm\[email protected]\node_modules\faiss-node\build\node.lib ε’Œε―Ήθ±‘ D:\pnpm_rep…
β”‚ -- Configuring incomplete, errors occurred!
β”‚ ERR! OMG Process terminated: 1
└─ Failed in 7s at D:\pnpm_repo\global\5\.pnpm\[email protected]\node_modules\faiss-node
 ELIFECYCLE  Command failed with exit code 1.

CUDA/GPU Support?

Curious why GPU support was disabled, and if you intend to eventually create a CUDA/GPU build?

Docker Build Fails on ARM v7

Environment:

  • Operating System: Linux/arm/v7
  • Node.js Version: 18.7.1
  • Package Version: 0.5.0

I'm using the node:18.17.1-bullseye image to create an image for different types of computers, including armv7, amd64, and arm64. To get the necessary stuff, I'm running apt update && apt install -y cmake libopenblas-dev patchelf.

This setup works well for arm64 and amd64 computers, but it's not working right for the armv7 computer. You can see the full error message here: GitHub Action Run.

Here's the error message for the armv7 computer:

#29 70.21 npm ERR! CMake Error at CMakeLists.txt:51 (add_subdirectory):
#29 70.21 npm ERR!   add_subdirectory given source "deps/faiss" which is not an existing
#29 70.21 npm ERR!   directory.
#29 70.21 npm ERR! 
#29 70.21 npm ERR! 
#29 70.21 npm ERR! CMake Error at CMakeLists.txt:52 (set_target_properties):
#29 70.21 npm ERR!   set_target_properties Can not find target to add properties to: faiss
#29 70.21 npm ERR! 
#29 70.21 npm ERR! 
#29 70.21 npm ERR! Debian:aarch64
#29 70.21 npm ERR! Copy DEPENDANCES: /lib/aarch64-linux-gnu/libgomp.so.1
#29 70.21 npm ERR! Copy DEPENDANCES: /lib/aarch64-linux-gnu/libopenblas.so.0
#29 70.21 npm ERR! Copy DEPENDANCES: /lib/aarch64-linux-gnu/libgfortran.so.5
#29 70.21 npm ERR! ERR! OMG Process terminated: 1

I'm looking for ideas on how to make it work properly on the ARM/v7, Can you guide me where i should be looking at?

dlopen Symbol not found error on macOS 10.15.7 and Netlify

Describe the bug
Trying to run the following code...

import { FaissStore } from "langchain/vectorstores/faiss";
import { OpenAIEmbeddings } from "langchain/embeddings/openai";
const vectorStore = await FaissStore.loadFromPython('./data/saved_index/', new OpenAIEmbeddings());
const results = await vectorStore.similaritySearch(query, 5);

Fails with the following Error on macOS 10.15.7

Uncaught (in promise) TRPCClientError: Could not import faiss-node. Please install faiss-node as a dependency with, e.g. `npm install -S faiss-node` and make sure you have `libomp` installed in your path.

Error: dlopen(/Users/michael/Workspace/potteryhelper.com/node_modules/faiss-node/build/Release/faiss-node.node, 1): Symbol not found: __ZNKSt3__115basic_stringbufIcNS_11char_traitsIcEENS_9allocatorIcEEE3strEv
  Referenced from: /Users/michael/Workspace/potteryhelper.com/node_modules/faiss-node/build/Release/faiss-node.node (which was built for Mac OS X 12.6)
  Expected in: /usr/lib/libc++.1.dylib

    at TRPCClientError.from (transformResult-6fb67924.mjs?v=5f4c615b:4:20)
    at httpBatchLink.mjs?v=5f4c615b:190:56
from @ transformResult-6fb67924.mjs?v=5f4c615b:4
(anonymous) @ httpBatchLink.mjs?v=5f4c615b:190
Promise.catch (async)
callWithAsyncErrorHandling @ runtime-core.esm-bundler.js:168
invoker @ runtime-dom.esm-bundler.js:345

and this error on Netlify...

May 29, 12:37:31 AM: 36d0dca3 INFO   Could not import faiss-node. Please install faiss-node as a dependency with, e.g. `npm install -S faiss-node` and make sure you have `libomp` installed in your path.

Error: libgomp.so.1: cannot open shared object file: No such file or directory

Environment:

  • Operating system: macOS 10.15.7
  • Nodejs Version: v18.12.1
  • Package Version: [e.g. v0.2.0]

To Reproduce
Steps to reproduce the behavior:

  1. npm install faiss-node and "langchain": "^0.0.84"
  2. run the above code

Expected behavior
index is rebuilt from python files and returns data

Screenshots

Additional context
I was able to get my local environment running by

  1. git checkout faiss-node & npm install
  2. Upgrade my CMake
  3. npm run build
  4. npm link
  5. then back in my project... npm link faiss-node... effectively swapping out the locally built module for my project and it's dependencies

So I guess it's just an issue with compiling the library for older versions of macOS?

Here are my package.json dependencies

  "dependencies": {
    "@pinia/nuxt": "^0.4.6",
    "@trpc/client": "^10.9.0",
    "@trpc/server": "^10.9.0",
    "daisyui": "^2.51.5",
    "faiss-node": "^0.2.0",
    "generate-password-ts": "^1.6.3",
    "langchain": "^0.0.84",
    "openai": "^3.2.1",
    "pickleparser": "^0.1.0",
    "pinia": "^2.0.30",
    "stripe": "^11.12.0",
    "superjson": "^1.12.2",
    "trpc-nuxt": "^0.8.0",
    "zod": "^3.20.2"
  },

and faiss-node in my package-lock.json...

    "node_modules/faiss-node": {
      "version": "0.2.0",
      "resolved": "https://registry.npmjs.org/faiss-node/-/faiss-node-0.2.0.tgz",
      "integrity": "sha512-4HNyK0WX26OTb4UbaJh810wY6gCYag53NssjMKCA9GT37bP0reGXz6YGOBjpbC/EzqJlYvsqKcDIzbJSfkTieg==",
      "hasInstallScript": true,
      "dependencies": {
        "bindings": "^1.5.0",
        "node-addon-api": "^6.0.0",
        "prebuild-install": "^7.1.1"
      },
      "engines": {
        "node": ">= 14.0.0"
      }
    },

Support for arm64

An extenstion to this #12

when I try to build docker image for arm64 the errors are shown as below:

#0 360.7 npm ERR! prebuild-install http request GET https://github.com/ewfian/faiss-node/releases/download/v0.2.1/faiss-node-v0.2.1-napi-v8-linuxmusl-arm64.tar.gz
#0 360.7 npm ERR! prebuild-install http request GET https://github.com/ewfian/faiss-node/releases/download/v0.2.1/faiss-#0 360.7 npm ERR! prebuild-install http request GET https://github.com/ewfian/faiss-node/releases/#0 360.7 npm ERR! prebuild-install http request GET https://github.com/ewfian/faiss-node/releases/download/v0.2.1/faiss-node-v0.2.1-napi-v8-linuxmusl-arm64.tar.gz
#0 360.7 npm ERR! prebuild-install http 404 https://github.com/ewfian/faiss-node/releases/download/v0.2.1/faiss-node-v0.2.1-napi-v8-linuxmusl-arm64.tar.gz
#0 360.7 npm ERR! prebuild-install warn install No prebuilt binaries found (target=8 runtime=napi arch=arm64 libc=musl platform=linux)
#0 360.7 npm ERR! sh: cmake-js: not found

Here's the command I use inside docker folder of Flowise:

  1. docker buildx use mybuilder
  2. docker buildx build --platform linux/amd64,linux/arm64 --no-cache -t flowiseai/flowise:latest --push .

Vscode Extension failed because it can not locate bindings file when importing faiss-node

Describe the bug
I am just trying to use the code provided in documentation inside the VSCODE extrension but I get the error below:

Code:

const { IndexFlatL2 } = require('faiss-node');

const dimension = 2;
const Faissindex = new IndexFlatL2(dimension);

console.log(Faissindex.getDimension()); // 2
console.log(Faissindex.isTrained()); // true
console.log(Faissindex.ntotal()); // 0

// inserting data into index.
Faissindex.add([1, 0]);
Faissindex.add([1, 2]);
Faissindex.add([1, 3]);
Faissindex.add([1, 1]);

console.log(Faissindex.ntotal()); // 4

const k = 4;
const results = Faissindex.search([1, 0], k);
console.log(results.labels); // [ 0, 3, 1, 2 ]
console.log(results.distances); // [ 0, 1, 4, 9 ]

Error:

Activating extension 'Extension.extension' failed: Could not locate the bindings file. Tried:
 β†’ /home/matheus/Projects/Extension/build/faiss-node.node
 β†’ /home/matheus/Projects/Extension/build/Debug/faiss-node.node
 β†’ /home/matheus/Projects/Extension/build/Release/faiss-node.node
 β†’ /home/matheus/Projects/Extension/out/Debug/faiss-node.node
 β†’ /home/matheus/Projects/Extension/Debug/faiss-node.node
 β†’ /home/matheus/Projects/Extension/out/Release/faiss-node.node
 β†’ /home/matheus/Projects/Extension/Release/faiss-node.node
 β†’ /home/matheus/Projects/Extension/build/default/faiss-node.node
 β†’ /home/matheus/Projects/Extension/compiled/16.14.2/linux/x64/faiss-node.node
 β†’ /home/matheus/Projects/Extension/addon-build/release/install-root/faiss-node.node
 β†’ /home/matheus/Projects/Extension/addon-build/debug/install-root/faiss-node.node
 β†’ /home/matheus/Projects/Extension/addon-build/default/install-root/faiss-node.node
 β†’ /home/matheus/Projects/Extension/lib/binding/node-v106-linux-x64/faiss-node.node.

Environment:

  • Operating system: [e.g. Linux]
  • Nodejs Version: [e.g. v18.15.0]
  • Package Version: [e.g. v0.1.0]
  • Using inside VSCODE Extenson

To Reproduce
Steps to reproduce the behavior:

  1. Put the code i suggested in the simplest possible vscode extension app (https://code.visualstudio.com/api/get-started/your-first-extension) and this error will appear when you hit F5 to test it.

Expected behavior
Faiss node should be imported

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Contribution for possible langchainjs integration

Hi,

great project! I'm looking for implementing the FAISS support for langchainjs. I've a bit of a background in writing node native binding modules for Node too and I believe it could be fun focusing on the following subset of features for bridging a currently existing gap and enable langchainjs to support FAISS as well.

Reading the original langchain python code and how FAISS is used there:
https://github.com/hwchase17/langchain/blob/master/langchain/vectorstores/faiss.py

... I identified the following APIs need to be supported by the binding:

faiss.IndexFlatL2(length: number): IndexFlatL2
faiss.read_index(name: string): IndexFlatL2
faiss.write_index(index: IndexFlatL2, path: string): void

// on IndexFlatL2:
index.add(embeddings: Float32Array): void
index.search(embedding: Float32Array, k: number): { scores: Float32Array, indices: Int32Array }
index.reconstruct(i: number): Float32Array
index.merge_from(targetIndex: IndexFlatL2): void

A quick read of the code shows that reconstruct and merge_from might be missing in the current implementation:
https://github.com/ewfian/faiss-node/blob/main/src/faiss.cc#L51

Is it fine for you if I "mess with the code" and PR? :)
Is there anything I should know regarding missing/broken/"I want to refactor this" things that I shouldn't touch? :)

Once I got it working, I can implement and contribute FAISS support for langchainjs here:
https://github.com/hwchase17/langchainjs/tree/main/langchain/src/vectorstores

...which I find is a pretty cool goal :)

Thanks and best,
Aron

(and sorry, I couldn't change the label to "enhancement" :))

Ability to encode/decode buffers when FS not available?

Happy to contribute, just wanted to know if there was a logical way to accomplish this? add is very expensive as it performs an encode, which adds up fast. Basically looking for similar efficiency to that of read/write from disk but from memory/buffers.

Vector store initial

Describe the bug
with langchain

const vectorStore = new FaissStore(new OpenAIEmbeddings());
const autogpt = AutoGPT.fromLLMAndTools(...);

autogpt.run(['goals']);
           throw new Error("Vector store not initialised yet. Try calling `fromTexts`, `fromDocuments` or `fromIndex` first.");
                  ^

Error: Vector store not initialised yet. Try calling `fromTexts`, `fromDocuments` or `fromIndex` first.

Environment:

  • mac os arm
  • Nodejs Version: 20.10.0
  • Package Version: "faiss-node": "^0.5.1",

To Reproduce
FYI

Expected behavior
should run

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Unavailable non-musl ARM64 build

Describe the bug
It seems like the available ARM64 prebuilt is currently musl-based only?

prebuild-install http 404 https://github.com/ewfian/faiss-node/releases/download/v0.2.2/faiss-node-v0.2.2-napi-v8-linux-arm64.tar.gz

Environment:

  • Operating system: Ubuntu 20.04.6 LTS
  • Nodejs Version: v18.15.0
  • Package Version: v0.2.2

To Reproduce
Steps to reproduce the behavior:

  1. Install the package
  2. Watch it fail to install and attempt a rebuild

Expected behavior
It installs fine using prebuilt binaries.

Logs

$ pnpm install
Lockfile is up to date, resolution step is skipped
Packages: +2
++
node_modules/.pnpm/[email protected]/node_modules/faiss-node: Running install script, failed in 3.2s
.../node_modules/faiss-node install$ prebuild-install --runtime napi --verbose || (npm i cmake-js && npm run build)
β”‚ prebuild-install info begin Prebuild-install version 7.1.1
β”‚ prebuild-install info looking for local prebuild @ prebuilds/faiss-node-v0.2.2-napi-v8-linux-arm64.tar.gz
β”‚ prebuild-install info looking for cached prebuild @ /home/ubuntu/.npm/_prebuilds/1c7143-faiss-node-v0.2.2-napi-v8-linux-arm64.tar.gz
β”‚ prebuild-install http request GET https://github.com/ewfian/faiss-node/releases/download/v0.2.2/faiss-node-v0.2.2-napi-v8-linux-arm64.tar.gz
β”‚ prebuild-install http 404 https://github.com/ewfian/faiss-node/releases/download/v0.2.2/faiss-node-v0.2.2-napi-v8-linux-arm64.tar.gz
β”‚ prebuild-install warn install No prebuilt binaries found (target=8 runtime=napi arch=arm64 libc= platform=linux)
...

Possible to reduce node package size?

Describe the bug
AWS Lambda functions are restricted to 250Mb including layers. Packaging the aws-sdk, faiss-node, fs, langchain, openai and adm-zip blows the limit.

I've pulled out only the aws sub-packages I need (s3 and secrets-manager) and the fs and adm-zip packages are tiny, but faiss-node is pretty big. I see it has Readme files and stuff, so I guess it's not 'minimal' - any chance of a slimmed down npm package?

Environment:

  • Operating system: AWS Lambda
  • Nodejs Version: v18.x
  • Package Version: latest

To Reproduce
Steps to reproduce the behavior:

  1. Zip the nodejs/node_modules hierarchy
  2. Attempt to create a Lambda layer
  3. Error is "Layer max. size is 250Mb" (paraphrased)

Expected behavior
The layer is correctly created.

Error: faiss-node package.json is not node-pre-gyp ready

Describe the bug
I cannot install faiss-node using node-pre-gyp.

I am receiving the following error:

stdout: '',
  stderr: 'node-pre-gyp ERR! UNCAUGHT EXCEPTION \n' +
    'node-pre-gyp ERR! stack Error: faiss-node package.json is not node-pre-gyp ready:\n' +
    'node-pre-gyp ERR! stack package.json must declare these properties: \n' +
    'node-pre-gyp ERR! stack binary.module_name\n' +
    'node-pre-gyp ERR! stack binary.module_path\n' +
    'node-pre-gyp ERR! stack binary.host\n' +
    'node-pre-gyp ERR! stack     at validate_config (/tmp/genezio-25053/3577lj/node_modules/@mapbox/node-pre-gyp/lib/util/versioning.js:220:11)\n' +
    'node-pre-gyp ERR! stack     at module.exports.evaluate (/tmp/genezio-25053/3577lj/node_modules/@mapbox/node-pre-gyp/lib/util/versioning.js:279:3)\n' +
    'node-pre-gyp ERR! stack     at clean (/tmp/genezio-25053/3577lj/node_modules/@mapbox/node-pre-gyp/lib/clean.js:16:27)\n' +
    'node-pre-gyp ERR! stack     at self.commands.<computed> [as clean] (/tmp/genezio-25053/3577lj/node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js:86:37)\n' +
    'node-pre-gyp ERR! stack     at run (/tmp/genezio-25053/3577lj/node_modules/@mapbox/node-pre-gyp/lib/main.js:81:30)\n' +
    'node-pre-gyp ERR! stack     at Object.<anonymous> (/tmp/genezio-25053/3577lj/node_modules/@mapbox/node-pre-gyp/lib/main.js:125:1)\n' +
    'node-pre-gyp ERR! stack     at Module._compile (node:internal/modules/cjs/loader:1256:14)\n' +
    'node-pre-gyp ERR! stack     at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)\n' +
    'node-pre-gyp ERR! stack     at Module.load (node:internal/modules/cjs/loader:1119:32)\n' +
    'node-pre-gyp ERR! stack     at Module._load (node:internal/modules/cjs/loader:960:12)\n' +
    'node-pre-gyp ERR! System Linux 5.15.0-82-generic\n'

Environment:

  • Operating system: [Ubuntu x64]
  • Nodejs Version: [v18.17.1]
  • Package Version: [0.3.0]

To Reproduce
Steps to reproduce the behavior:

  1. Install faiss-node and go to node_modules/faiss-node.
  2. Run the following command in node_modules/faiss-node
npx node-pre-gyp --update-binary --fallback-to-build --target_arch=arm64 --target_platform=linux --target_libc=glibc clean install faiss--node

You should receive the same error as I did.

Expected behavior

The following command should be successful:

npx node-pre-gyp --update-binary --fallback-to-build --target_arch=arm64 --target_platform=linux --target_libc=glibc clean install faiss--node

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

** Possible Solution**

In the package.json the binary section is not complete, hence node-pre-gyp doesn't know how to fetch the binary.

I tested, and this snippet of code does the trick (although it's incomplete because I hardcoded the napi-version to v8):

"binary": {
    "module_name": "faiss-node",
    "module_path": "./build/Release/faiss-node.node",
    "package_name": "faiss-node-v{version}-napi-v8-{platform}-{arch}.tar.gz",
    "host": "https://github.com/",
    "remote_path": "ewfian/faiss-node/releases/download/v{version}"
  },

Can you maybe fix this or can I propose a PR?

Does not work without internet connection

Describe the bug
Does not work without internet connection

Environment:

  • Operating system: Windows 10
  • Nodejs Version: v18.15.0
  • Package Version: 0.5.1

To Reproduce
Steps to reproduce the behavior:

  1. Close internet connection
  2. Observe behavior

Expected behavior
Should work with internet connection

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.