ewfian / faiss-node

Node.js bindings for faiss
https://www.npmjs.com/package/faiss-node
MIT License
107 stars 10 forks source link

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

Open andreia-oca opened 1 year ago

andreia-oca commented 1 year ago

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:

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?

ewfian commented 1 year ago

@andreia-oca PRs are welcome,Thank you.