FG
🤖 AI & LLMs

Getting ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined

Freshalmost 3 years ago
Mar 14, 20260 views
Confidence Score76%
76%

Problem

We are getting `Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in langchain\package.json ` It started happening from versions 0.0.13 and up. It works fine for 0.0.12.

Error Output

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in langchain\package.json

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
High Confidence Fix
74% confidence100% success rate3 verificationsLast verified Mar 14, 2026

Solution: Getting ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined

Low Risk

> The langchain package is now ESM only. You can fix that by adding `"type": "module"` to your `package.json`. You can find more information here https://hwchase17.github.io/langchainjs/docs/getting-started/ @nfcampos I'm not sure I understand why this requirement exists. Is this on purpose or will this be changed? Happy to open up a PR with the fix if that would be accepted.

74

Trust Score

3 verifications

100% success
  1. 1

    > The langchain package is now ESM only. You can fix that by adding `"type": "mo

    > The langchain package is now ESM only. You can fix that by adding `"type": "module"` to your `package.json`. You can find more information here https://hwchase17.github.io/langchainjs/docs/getting-started/

  2. 2

    @nfcampos I'm not sure I understand why this requirement exists. Is this on purp

    @nfcampos I'm not sure I understand why this requirement exists. Is this on purpose or will this be changed? Happy to open up a PR with the fix if that would be accepted.

Validation

Resolved in langchain-ai/langchainjs GitHub issue #185. Community reactions: 3 upvotes.

Verification Summary

Worked: 3
Partial: 1
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

langchainllmairagenv/packaging