Can we run Pre-request script having axios in Postman/Newman CLI

I have API collection which has pre-request script wherein API calls are been done using axios() using create() → then() → catch() methods. Now when we import this collection to Postman API client whether we will be able to run “Pre-request Script” having axios() in postman and also when i tried to run this collection via Newman CLI, getting below error:
image

How i can overcome on this issue, do i need to install any dependent packages in Newman or via npm so that axios() module gets identified and can run my collection via Newman CLI.

Axios() is not part of the Postman Sandbox, so how are you including that library in your pre-request script? Does this work from the Postman Desktop or Web App?

You can run Newman directly by calling its executable, or you can use Newman as a NodeJS library.

Using Newman as a nodejs library | Postman Learning Center

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.