chroma: Nextjs invalid exports

From discord: https://discord.com/channels/1073293645303795742/1130258136905814066/1130258136905814066

./node_modules/chromadb/dist/main/embeddings/WebAIEmbeddingFunction.js
Module not found: Package path . is not exported from package C:\personal-dev\ai-prototypes-2\node_modules@visheratin\web-ai (see exports field in C:\personal-dev\ai-prototypes-2\node_modules@visheratin\web-ai\package.json)

Import trace for requested module:
./node_modules/chromadb/dist/main/embeddings/WebAIEmbeddingFunction.js

Anyone know how i can make webpack or nextjs not through these module not found issues? It seems like it shouldn't be importing this unless the function is actually being ran?

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 1
  • Comments: 20 (10 by maintainers)

Commits related to this issue

Most upvoted comments

@shuding, thank you for the lead! I just opened a PR that addresses the issue with require/import statements. I tested the fixed version, and it works in both browser and Node.js.

This seems to be working fine now with Next JS, using: "chromadb": "^1.5.9", "langchain": "^0.0.150", "next": "^13.4.19",

Here is a working example:

https://github.com/e-roy/langchain-chatbot-demo/tree/main

For this error:

Module not found: Can't resolve '@visheratin/web-ai-node/multimodal' in '/Users/xxx/Documents/GitHub/langchain/javascript/langchain-nextjs/node_modules/chromadb/dist/module/embeddings'

Import trace for requested module:
./node_modules/chromadb/dist/module/embeddings/WebAIEmbeddingFunction.js
./node_modules/chromadb/dist/module/index.js
./node_modules/langchain/dist/vectorstores/chroma.js
./node_modules/langchain/vectorstores/chroma.js
./app/api/retrieval/ingest/route.ts

You can adjust your next.config.js file and ignore it by adding

  webpack: (config, {}) => {
    config.resolve.fallback = {
      "@visheratin/web-ai-node": false,
    };
    return config;
  },

interesting! Will try out. Thx for notifying!

thank you @e-roy ! asking Vercel for help on this

I got this error with using Next JS using the newer app router

I rolled back to "chromadb": "1.5.2", and no longer saw the error.