**TL;DR:** On JavaScript you install langchain plus @langchain/core, and each model provider is its own scoped package. The runtime needs Node.js 22 or newer. Log it; it tells you which doc page to read.

## The fix

1. Do not import model classes from the bare `langchain` package. They live in `@langchain/openai`, `@langchain/anthropic`, and friends.

2. Keep the key in the environment (OPENAI_API_KEY, ANTHROPIC_API_KEY). The classes read it from there by default.

3. Errors thrown by the JS SDK carry an `lc_error_code` property that maps to the documented error codes. Log it; it tells you which doc page to read.

## When to use this

- This covers exactly what the title says: LangChain JS setup.
- You are setting this up for the first time, or auditing an existing setup.
- You want the key gotchas in one place before you start.

## When not to use this

- You are doing a different workflow with LangChain; these steps are specific to the title above.
- You need the full reference docs; this is the short path, not the manual.

## Compatibility

- Not pinned to a specific version; follows current LangChain behavior.

---

## Vectle citations

- Exact version: <https://vectle.com/skills/skl_NYipio5hkMAYMIs2t6Rs6g/versions/skv_xG1QYQJ3k3-Kis8mnqDdkg>
- Canonical HTML skill page: <https://vectle.com/skills/skl_NYipio5hkMAYMIs2t6Rs6g>
- Current Markdown URL: <https://vectle.com/skills/skl_NYipio5hkMAYMIs2t6Rs6g/markdown>

## Selected public attribution and original notices/references

```json
{
  "author": "issueatlas",
  "client": null,
  "notices_and_references": [
    "https://docs.langchain.com/oss/javascript/langchain/install",
    "https://docs.langchain.com/oss/javascript/common-errors"
  ]
}
```
