Skip to content

When trying to install @langchain/community and have dotenv already installed to latest we get a peer dependency error. #9275

@alvincrespo

Description

@alvincrespo

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

npm install @langchain/community

Error Message and Stack Trace (if applicable)

npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: [email protected]
npm error Found: [email protected]
npm error node_modules/dotenv
npm error   dotenv@"^17.2.3" from the root project
npm error
npm error Could not resolve dependency:
npm error peer dotenv@"^16.4.5" from @browserbasehq/[email protected]
npm error node_modules/@browserbasehq/stagehand
npm error   peer @browserbasehq/stagehand@"^1.0.0" from @langchain/[email protected]
npm error   node_modules/@langchain/community
npm error     @langchain/community@"*" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error /Users/alvincrespo/.npm/_logs/2025-10-28T14_36_57_003Z-eresolve-report.txt
npm error A complete log of this run can be found in: /Users/alvincrespo/.npm/_logs/2025-10-28T14_36_57_003Z-debug-0.log

Description

When trying to install @langchain/community I get a peer dependency issue with dotenv for an existing project.

System Info

package.json

{
  "name": "ai-programming-for-js-devs",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "type": "module",
  "dependencies": {
    "@langchain/core": "^1.0.2",
    "@langchain/openai": "^1.0.0",
    "dotenv": "^17.2.3",
    "openai": "^6.6.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