yarricharY
Convex Community3y ago
13 replies
yarrichar

langchain - can't find import when doing: npm run build

I'm using langchain in one of my actions, and it works fine for local dev (i.e. when running npm run dev, but when I try and do a build with
npm run build
I get the following error:
- info Linting and checking validity of types ..Failed to compile.

./convex/util/pineconeUtil.ts:4:28
Type error: Cannot find module 'langchain/document_loaders' or its corresponding type declarations.

  2 | 
  3 | import { PineconeClient } from "@pinecone-database/pinecone";
> 4 | import { TextLoader } from "langchain/document_loaders";
    |                            ^
  5 | import { OpenAIEmbeddings } from "langchain/embeddings";
  6 | import { Blob } from "buffer";
  7 | import { RecursiveCharacterTextSplitter } from "langchain/text_splitter";


The first line of that file is "use node".

Any ideas on what I'm doing wrong / what the difference is between npm run dev and
npm run build
?

Thanks!
Was this page helpful?