This topic was automatically generated from Slack. You can find the original thread here.
Hi all,
I am trying to run a nodejs code snippet but i get npm install failed error, pls help me with resolving it
**import** path **from** "path";
**import** {DocxLoader} **from** "langchain/document_loaders/fs/docx";
**import** {TextLoader} **from** "langchain/document_loaders/fs/text";
**import** {PDFLoader} **from** "langchain/document_loaders/fs/pdf";
export **default** defineComponent({
**async** run({ steps, $ }) {
**const** filePath = "/tmp/" + steps.download_file.$return_value.name;
**const** fileExtension = path.extname(filePath).toLowerCase();
`**switch** (fileExtension) {`
`**case** ".docx":`
`**const** docxLoader = **new** DocxLoader(filePath);`
`**const** docxDocs = **await** docxLoader.load();`
`console.log("Loaded DOCX document:", docxDocs);`
`**break**;`
`**case** ".txt":`
`**const** textLoader = **new** TextLoader(filePath);`
`**const** textDocs = **await** textLoader.load();`
`console.log("Loaded text document:", textDocs);`
`**break**;`
`**case** ".pdf":`
`**const** pdfLoader = **new** PDFLoader(filePath);`
`**const** pdfDocs = **await** pdfLoader.load();`
`console.log("Loaded PDF document:", pdfDocs);`
`**break**;`
`**default**:`
`console.error("Unsupported file extension:", fileExtension);`
`}`
},
});
This is the code and ss of err is also attached
