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

**URL:** <https://community.postman.com/t/can-we-run-pre-request-script-having-axios-in-postman-newman-cli/63907>\
**Category:** Help Hub\
**Tags:** newman-project, collections\
**Created:** [July 10, 2024, 12:01pm UTC](https://community.postman.com/t/can-we-run-pre-request-script-having-axios-in-postman-newman-cli/63907 "2024-07-10T12:01:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lunar-module-cosmo10](https://avatars.discourse-cdn.com/v4/letter/l/50afbb/32.png) [@lunar-module-cosmo10](https://community.postman.com/u/lunar-module-cosmo10)\
**Post date:** [July 10, 2024, 12:01pm UTC](https://community.postman.com/t/can-we-run-pre-request-script-having-axios-in-postman-newman-cli/63907/1 "2024-07-10T12:01:18Z")

</div>

> **Archived topic — this may be out of date.**  
> Newman has been replaced by the **[Postman CLI](https://learning.postman.com/docs/postman-cli/postman-cli-overview/)**, Postman’s official, signed command-line tool. It runs collections as Newman did, and also lints API specs, runs mocks and monitors, and syncs local files with Postman from your terminal, CI/CD pipeline or coding agent.  
> Working with an AI coding agent? The [Postman plugin](https://github.com/postmanlabs/postman-plugin) lets agents in Claude Code, Cursor, Codex and others design, mock, test and ship APIs with Postman.  
> For current help, see the [Postman docs](https://learning.postman.com/docs/), try the free [Postman tools](https://www.postman.com/tools) (no account needed), or join us on [Discord](https://discord.gg/58aNNsRBGR).

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](https://us1.discourse-cdn.com/getpostman/original/3X/c/1/c1e75a050cfe81ea209b70a9e296923da0521cb8.png)

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.

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [July 10, 2024, 12:52pm UTC](https://community.postman.com/t/can-we-run-pre-request-script-having-axios-in-postman-newman-cli/63907/2 "2024-07-10T12:52:15Z")

</div>

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](https://learning.postman.com/docs/collections/using-newman-cli/installing-running-newman/#using-newman-as-a-nodejs-library)

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/system/32/29796_2.png) [@system](https://community.postman.com/u/system)\
**Post date:** [August 9, 2024, 12:53pm UTC](https://community.postman.com/t/can-we-run-pre-request-script-having-axios-in-postman-newman-cli/63907/3 "2024-08-09T12:53:02Z")

</div>

Closed on August 9, 2024, 12:53pm UTC

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