Skip to content

npm install @langchain/community fails (ERESOLVE) with zod@4 due to stagehand peer dep zod@^3.23.8 #9808

@anouar-bm

Description

@anouar-bm

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

fresh repro

mkdir temp_app && cd temp_app
npm init -y
npm i zod@^4
npm i @langchain/community

Error Message and Stack Trace (if applicable)

npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree

npm error While resolving: temp_app@1.0.0
npm error Found: zod@4.3.5
npm error node_modules/zod
npm error zod@"^4.3.5" from the root project
npm error zod@"^3.25.76 || ^4" from @langchain/community@1.1.4
npm error node_modules/@langchain/community
npm error @langchain/community@"*" from the root project

npm error Could not resolve dependency:
npm error peer zod@"^3.23.8" from @browserbasehq/stagehand@1.14.0
npm error node_modules/@browserbasehq/stagehand
npm error peer @browserbasehq/stagehand@"^1.0.0" from @langchain/community@1.1.4
npm error node_modules/@langchain/community
npm error @langchain/community@"*" from the root project

Description

npm i @langchain/community fails with ERESOLVE in projects that use zod@4.x.

Root cause: @langchain/community@1.1.4 pulls in @browserbasehq/stagehand (Stagehand Toolkit integration), and npm ends up resolving @browserbasehq/stagehand@1.14.0, which pins peerDependencies: zod@"^3.23.8" (Zod v3 only). This conflicts with zod@4.3.5 installed in the root project and causes the install failure. [web:6][web:9]

Extra context: Stagehand added Zod v4 compatibility in Stagehand TS 2.4.3 (see browserbase/stagehand PR 944 and Stagehand release notes), but @langchain/community@1.1.4 resolves @browserbasehq/stagehand@1.14.0 which still requires peerDependencies: zod@^3.23.8, causing ERESOLVE in Zod 4 projects.


Workarounds:

  • Downgrade: npm i zod@^3.23.8
  • Or ignore peers: npm i @langchain/community --legacy-peer-deps (not ideal)

Request:

  • Make Stagehand optional (optional peer / separate install path) so @langchain/community installs don’t fail when Stagehand isn’t used, OR
  • Update/relax the Stagehand peer dependency/version resolution so it can use a Stagehand version that supports Zod 4 (>= 2.4.3). [web:31]

Related issues: #9275 (dotenv peer conflict) and #8661 (openai peer conflict). [web:1][web:5]

System Info

pnpm info @langchain/community
1.1.4
macOS
Node v25.2.1
pnpm 10.14.0

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