Langchain core/traces conflict after deploying to aws

Hello team!

I am working in a project using langChain for a chatbot workflow. We are using langChain v1, and we were working perfectly with it, but today, out of nowhere, we started getting a conflict between ansi-styles and a common js compiled version of traces/console.js from langchain core. It is breaking due to console.js calling the module using a require, has anyone else had this problem?

Hey @miguelVal28

Yeah, this kind of issue usually happens when there’s a dependency mismatch rather than something breaking in your own code.

ansi-styles has moved toward ESM in newer versions, and if langchain-core (or something in your tree) is still requiring a CommonJS build like traces/console.js, you can suddenly hit a require() vs import conflict — especially if your lockfile changed or someone reinstalled deps.

A few quick things to check:

  • :magnifying_glass_tilted_right: Did ansi-styles get bumped to a newer major version?

  • :locked: Try deleting node_modules + lockfile and reinstalling.

  • :package: Pin ansi-styles to an earlier compatible version.

  • :puzzle_piece: Run npm ls ansi-styles (or pnpm why) to see who’s pulling it in.

Most of the time, locking the version or aligning everything to either full ESM or full CJS fixes it.

Hey Miguel! We bumped this dependency a bit too eagerly – langchain is still supporting cjs. Have since reverted this and pushed a new patch bump

1 Like