langChain createAgent giving error in typescript

Hello,

I’m new to langChain and I’m experimenting some basic feature building a simple RAG agent.

Using the sample code at Build a RAG agent with LangChain - Docs by LangChain I have an issue importing CreateAgent. In fact this is my first piece of code

import * as z from "zod";
import { tool } from "@langchain/core/tools";
import {
  PGVectorStore,
  DistanceStrategy,
} from "@langchain/community/vectorstores/pgvector";
import { OpenAIEmbeddings } from "@langchain/openai";
import { PoolConfig } from "pg";
import { createAgent } from "langchain";
import { SystemMessage } from "@langchain/core/messages";


The line import { createAgent } from “langchain.agents”; give me an error “Cannot find module ‘langchain’ or its corresponding type declarations.”

This is my package.json

{
  "name": "langchain_search",
  "type": "module",
  "private": true,
  "scripts": {
    "build": "nuxt build",
    "dev": "nuxt dev",
    "generate": "nuxt generate",
    "preview": "nuxt preview",
    "postinstall": "nuxt prepare"
  },
  "dependencies": {
    "@langchain/classic": "^1.0.22",
    "@langchain/community": "^1.1.22",
    "@langchain/core": "^1.1.30",
    "@langchain/ollama": "^1.2.6",
    "@langchain/openai": "^1.3.0",
    "nuxt": "^4.3.1",
    "pdf-parse": "^1.1.1",
    "pg": "^8.20.0",
    "uuid": "^13.0.0",
    "vue": "^3.5.29",
    "vue-router": "^4.6.4",
    "zod": "^4.3.6"
  }
}

I did some searches but I was not able to find the right import path.

hi @AgoDoo

try to install again this npm install langchain @langchain/core and remove npm uninstall @langchain/classic
Remove node_modules and package-lock.json before