Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NextJS Faiss Error #52

Open
INIRU opened this issue Nov 20, 2024 · 0 comments
Open

NextJS Faiss Error #52

INIRU opened this issue Nov 20, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@INIRU
Copy link

INIRU commented Nov 20, 2024

Describe the bug
NextJS Faiss-node error

⨯ Error: Could not import faiss-node. Please install faiss-node as a dependency with, e.g. `npm install -S faiss-node`.

Error: Could not locate the bindings file. Tried:
 → /Users/iniru/Documents/MJC-CHAT/mjc-next/node_modules/faiss-node/build/faiss-node.node
 → /Users/iniru/Documents/MJC-CHAT/mjc-next/node_modules/faiss-node/build/Debug/faiss-node.node
 → /Users/iniru/Documents/MJC-CHAT/mjc-next/node_modules/faiss-node/build/Release/faiss-node.node
 → /Users/iniru/Documents/MJC-CHAT/mjc-next/node_modules/faiss-node/out/Debug/faiss-node.node
 → /Users/iniru/Documents/MJC-CHAT/mjc-next/node_modules/faiss-node/Debug/faiss-node.node
 → /Users/iniru/Documents/MJC-CHAT/mjc-next/node_modules/faiss-node/out/Release/faiss-node.node
 → /Users/iniru/Documents/MJC-CHAT/mjc-next/node_modules/faiss-node/Release/faiss-node.node
 → /Users/iniru/Documents/MJC-CHAT/mjc-next/node_modules/faiss-node/build/default/faiss-node.node
 → /Users/iniru/Documents/MJC-CHAT/mjc-next/node_modules/faiss-node/compiled/21.7.3/darwin/arm64/faiss-node.node
 → /Users/iniru/Documents/MJC-CHAT/mjc-next/node_modules/faiss-node/addon-build/release/install-root/faiss-node.node
 → /Users/iniru/Documents/MJC-CHAT/mjc-next/node_modules/faiss-node/addon-build/debug/install-root/faiss-node.node
 → /Users/iniru/Documents/MJC-CHAT/mjc-next/node_modules/faiss-node/addon-build/default/install-root/faiss-node.node
 → /Users/iniru/Documents/MJC-CHAT/mjc-next/node_modules/faiss-node/lib/binding/node-v120-darwin-arm64/faiss-node.node
    at FaissStore.importFaiss (webpack-internal:///(rsc)/./node_modules/@langchain/community/dist/vectorstores/faiss.js:362:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async readIndex (webpack-internal:///(rsc)/./node_modules/@langchain/community/dist/vectorstores/faiss.js:289:37)
    at async Promise.all (index 1)
    at async FaissStore.loadFromPython (webpack-internal:///(rsc)/./node_modules/@langchain/community/dist/vectorstores/faiss.js:292:32)
    at async POST (webpack-internal:///(rsc)/./src/app/api/chatrooms/[id]/conversations/route.ts:49:25)
    at async /Users/iniru/Documents/MJC-CHAT/mjc-next/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:55759
    at async eO.execute (/Users/iniru/Documents/MJC-CHAT/mjc-next/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:46527)
    at async eO.handle (/Users/iniru/Documents/MJC-CHAT/mjc-next/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:57093)
    at async doRender (/Users/iniru/Documents/MJC-CHAT/mjc-next/node_modules/next/dist/server/base-server.js:1345:42)
    at async cacheEntry.responseCache.get.routeKind (/Users/iniru/Documents/MJC-CHAT/mjc-next/node_modules/next/dist/server/base-server.js:1555:40)
    at async DevServer.renderToResponseWithComponentsImpl (/Users/iniru/Documents/MJC-CHAT/mjc-next/node_modules/next/dist/server/base-server.js:1475:28)
    at async DevServer.renderPageComponent (/Users/iniru/Documents/MJC-CHAT/mjc-next/node_modules/next/dist/server/base-server.js:1901:24)
    at async DevServer.renderToResponseImpl (/Users/iniru/Documents/MJC-CHAT/mjc-next/node_modules/next/dist/server/base-server.js:1939:32)
    at async DevServer.pipeImpl (/Users/iniru/Documents/MJC-CHAT/mjc-next/node_modules/next/dist/server/base-server.js:914:25)
    at async NextNodeServer.handleCatchallRenderRequest (/Users/iniru/Documents/MJC-CHAT/mjc-next/node_modules/next/dist/server/next-server.js:272:17)
    at async DevServer.handleRequestImpl (/Users/iniru/Documents/MJC-CHAT/mjc-next/node_modules/next/dist/server/base-server.js:810:17)
    at async /Users/iniru/Documents/MJC-CHAT/mjc-next/node_modules/next/dist/server/dev/next-dev-server.js:339:20
    at async Span.traceAsyncFn (/Users/iniru/Documents/MJC-CHAT/mjc-next/node_modules/next/dist/trace/trace.js:154:20)
    at async DevServer.handleRequest (/Users/iniru/Documents/MJC-CHAT/mjc-next/node_modules/next/dist/server/dev/next-dev-server.js:336:24)
    at async invokeRender (/Users/iniru/Documents/MJC-CHAT/mjc-next/node_modules/next/dist/server/lib/router-server.js:173:21)
    at async handleRequest (/Users/iniru/Documents/MJC-CHAT/mjc-next/node_modules/next/dist/server/lib/router-server.js:350:24)
    at async requestHandlerImpl (/Users/iniru/Documents/MJC-CHAT/mjc-next/node_modules/next/dist/server/lib/router-server.js:374:13)
    at async Server.requestListener (/Users/iniru/Documents/MJC-CHAT/mjc-next/node_modules/next/dist/server/lib/start-server.js:141:13)

Environment:

  • Operating system: Mac Seq 15.0 M3 PRO
  • Nodejs Version: v21.7.3
  • Package Version: ^0.5.1

To Reproduce
Steps to reproduce the behavior:

  1. nextJS app route api faissStoreLoad
import createMDX from '@next/mdx';

/** @type {import('next').NextConfig} */
const nextConfig = {
  reactStrictMode: false,
  transpilePackages: ['three', 'next-mdx-remote'],
  pageExtensions: ['js', 'jsx', 'md', 'mdx', 'ts', 'tsx'], // .md 파일도 페이지로 사용할 수 있음.
  images: {
    remotePatterns: [
      {
        protocol: 'https',
        hostname: 'lh3.googleusercontent.com',
      },
    ],
  },
  experimental: {
    serverComponentsExternalPackages: ['faiss-node'],
  },
};

const withMDX = createMDX({});

export default withMDX(nextConfig);
@INIRU INIRU added the bug Something isn't working label Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant