Skip to content

dotenv peerDependency #1109

@YasharF

Description

@YasharF

Before submitting an issue, please:

Environment Information

Start a blank Nodejs project with npm. Install dotenv, and then try to install a package that has a dependency on stagehand.

Stagehand:

  • Language/SDK: nodejs + npm
  • Stagehand version: @browserbasehq/stagehand@1.14.0 , but it looks like the latest version has the same issue

AI Provider:

N/A

Issue Description

Is there a strong reason why dotenv is a peerDependency and not a regular dependency? As a peer dependency it is constantly creating headaches and blocks automation around package updates (aka with dependabot). A peerDependency forces consumers to install a version that matches the range you have listed; otherwise npm fails unless the application that has stagehand somewhere in its dependency tree adds an override in its package.json. But then overrides need to be manually maintained by the application owner whenever the declared peer range is mismatched, even for simple patch bumps.

dotenv isn't that much of a crazy package, which is why I am wondering if we could come up with a way that it is not strapping everyone downstream and forcing them to manually deal with the package update.

Also it might be worth to update it to the v17 major version. Let me know if you would like me to help by submitting a PR. Thanks

Steps to Reproduce

  1. mkdir temp
  2. cd temp
  3. npm init -y
  4. npm install dotenv
  5. npm install @langchain/community

Note that I am not even installing stagehand, but @langchain/community has a dependency on stagehand.

Minimal Reproduction Code

no code, just the above 5 steps.

Error Messages / Log trace

$ npm install @langchain/community
npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: temp@1.0.0
npm error Found: dotenv@17.2.3
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/stagehand@1.14.0
npm error node_modules/@browserbasehq/stagehand
npm error   peer @browserbasehq/stagehand@"^1.0.0" from @langchain/community@0.3.57
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

Screenshots / Videos

N/A

Related Issues

Are there any related issues or PRs?

I didn't find one

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions