How to Resolve 'npm install failed' Error When Running a NodeJS Code Snippet?

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

pls help.

, some libraries are not compatible with Pipedream due to its serverless nature, so you might need to research for other libraries.

If you’d like to hire a Pipedream expert for your usecase, feel free to use this link: Connect with a Pipedream Partner

But there is same code which used to work previously and now throwing error.

Do you know from when that it breaks, have you changed the Node.js version of your action? I think maybe the library have a new version upgraded that’s not working with Pipedream, you can check the library version history to see if it’s true.

everything is same nothing has changed . i was working with pinecone and previously pinecone wasn’t supported with python and was told to shift to node .It worked well and now again it throws npm install failed

Have you checked the langchain library version to see if they have updated a new version recently?

it is same.