I am trying to update langchain packages, my packages are as followed:
- langchain
- @langchain/community
- langfuse-langchain
- @langchain/openai
- @langchain/google-genai
- @google/generative-ai
I can’t update the package and I keep getting this error:
`npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/puppeteer
npm ERR! peerOptional puppeteer@"^22.0.0" from @langchain/[email protected]
npm ERR! node_modules/@langchain/community
npm ERR! @langchain/community@"^0.2.21" from the root project
npm ERR! peerOptional @langchain/community@"*" from [email protected]
npm ERR! node_modules/langchain
npm ERR! langchain@"^0.2.11" from the root project
npm ERR! 3 more (langfuse-langchain, @langchain/community, @getzep/zep-cloud)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional puppeteer@"^19.7.2" from [email protected]
npm ERR! node_modules/langchain
npm ERR! langchain@"^0.2.11" from the root project
npm ERR! node_modules/langfuse-langchain
npm ERR! langfuse-langchain@"*" from the root project
npm ERR! 2 more (@langchain/community, @getzep/zep-cloud)
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.`
From the message, I think it’s because of puppeteer conflict, so I tried uninstalling every single one of the packages and re-install them, I found out that the 3 packages that cause problems are:
- langchain
- @langchain/community
- langfuse-langchain
I found a solution (https://github.com/langchain-ai/langchainjs/issues/5673) is to use--legacy-peer-deps
while installing these 3 packages. It works but I don’t think it is a good solution. Is--legacy-peer-deps
the only workaround?
Another solution by (NPM Err: Unable to resolve dependencies) is to completely wide node_modules and package-lock.json but again I was advise not to touch package-lock.json.