Skip to content

Error loading "langsmith" package with the simplest langchain 1.0.1 scaffold #9257

@ddewaele

Description

@ddewaele

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

package.json

{
  "name": "langgraphjs-v1",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "type": "module",
  "author": "",
  "license": "ISC",
  "description": "",
  "dependencies": {
    "langchain": "^1.0.1",
    "langsmith": "^0.3.74"
  }
}

code

import * as hub from "langchain/hub";
import { Client } from "langsmith";

const prompt = await hub.pull("test-mustache-format",{
    includeModel: false,
});

Error Message and Stack Trace (if applicable)

Error: Error loading "langsmith" package, install it via `npm install langsmith` before you use this function.
Error: (0 , import_range.require_range) is not a function
    at loadLangSmith (/Users/davydewaele/Projects/AgenticAI/langgraph-tutorial/langgraphjs-v1/node_modules/.pnpm/langchain@1.0.1_@langchain+core@1.0.1/node_modules/langchain/dist/hub/base.js:102:9)
    at async basePull (/Users/davydewaele/Projects/AgenticAI/langgraph-tutorial/langgraphjs-v1/node_modules/.pnpm/langchain@1.0.1_@langchain+core@1.0.1/node_modules/langchain/dist/hub/base.js:24:17)
    at async Module.pull (/Users/davydewaele/Projects/AgenticAI/langgraph-tutorial/langgraphjs-v1/node_modules/.pnpm/langchain@1.0.1_@langchain+core@1.0.1/node_modules/langchain/src/hub/index.ts:40:24)
    at async <anonymous> (/Users/davydewaele/Projects/AgenticAI/langgraph-tutorial/langgraphjs-v1/index.ts:4:16)

Node.js v20.17.0

Description

Expected these 5 lines of code to work with 1.0.1
Works fine with

  "dependencies": {
    "@langchain/core": "0.3.72",
    "langchain": "0.3.36"
  }

The same issue was logged (and apparently fixed in 1.0.0-alpha) #9049
However in the current main branch this fix is no longer present (probably due to changes in the build system)

System Info

System Info
OS : Mac
Node v20
Package manager npm

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions