-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Checked other resources
- This is a bug, not a usage question. For questions, please use the LangChain Forum (https://forum.langchain.com/).
- I added a very descriptive title to this issue.
- I searched the LangChain.js documentation with the integrated search.
- I used the GitHub search to find a similar question and didn't find it.
- I am sure that this is a bug in LangChain.js rather than my code.
- The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
Example Code
import { pull } from 'langchain/hub';
const prompt = await pull('prompt-name');Error Message and Stack Trace (if applicable)
Error: 93 | try {
94 | const { Client } = await import("../node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/index.js");
95 | return Client;
96 | } catch (error) {
97 | const errorMessage = error instanceof Error ? error.message : String(error);
98 | throw new Error(`Error loading "langsmith" package, install it via \`npm install langsmith\` before you use this function.\nError: ${errorMessage}`);
| ^
| error: Error loading "langsmith" package, install it via `npm install langsmith` before you use this function.
| Error: require_range is not a function. (In 'require_range()', 'require_range' is undefined)
| pregelTaskId: "b3e60029-03bd-5236-8420-5ccd12b26dc4",
|
| at loadLangSmith (/app/node_modules/langchain/dist/hub/base.js:98:13)
|Description
I'm trying to use the langchain/hub pull method and it's throwing an error. I've looked a bit into the code and it seems that the issue is that during the build process, the dynamic import in the code here is being substituted with the wrong relative path. You can see this path exists in the released NPM build here (see line 94).
When I tested a fix locally of replacing the long ../node_modules/.pnpm/... string with langsmith, everything worked as intended.
System Info
langchain version: ^1.0.0-alpha.5
platform: macOS
Node version: v22.12.0
bun version: v1.2.22
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working