#Help Please anyone: TypeError: Module name, 'langchain/text_splitter' does not resolve to a valid UR

4 messages · Page 1 of 1 (latest)

gusty pagoda
#

I spent some 5 hours yesterday trying to figure out why the error above keeps coming up.

Here is my code snippet.
import { RecursiveCharacterTextSplitter} from "langchain/text_splitter";

try {
const result = await fetch('scrimba-info.txt')
const text = await result.text()

const splitter = new RecursiveCharacterTextSplitter({
    chunkSize: 500
})

const output = await splitter.createDocuments([text])
console.log(output)

} catch (err) {
console.log(err)
}

Prior to setting this up i used: basically as intructed on the documentation
npm install -S langchain
npm install @langchain/community
npm install @langchain/openai

hushed stirrup
#

Is the module instlaled? Is it listed in your package.json?

Sometimes deleting node_modules and running npm install helps

gusty pagoda
#

The module is installed

#

Thank you for offering help. I have just about tried everything