# How to use any Nodejs dependened modules (pino-pretty, pm2) with Bunjs

![](https://i.imgur.com/kWw8WaN.png)

## **Why This Occurs?**

* **`pino-pretty`** requires Node.js to execute
* Thus it looks for the **`node`** executable.

## **How to Resolve?**

<details>

<summary>First, find the installation path of **`pino-pretty`** using the **`which`** command</summary>

```shell
which pino-pretty
```

</details>

<details>

<summary>Then, you can use **`bun`** to execute **`pino-pretty`** by specifying its full path.</summary>

\- \_This can indeed be cumbersome\_ 😅

</details>

<details>

<summary>Suppose the path is **`$HOME/.bun/bin/pino-pretty`**</summary>

```shell
bun $HOME/.bun/bin/pino-pretty
```

</details>

<details>

<summary>Here’s an example of how to use **`bun`** to pipe the output of a TypeScript file through **`pino-pretty`**</summary>

```shell
bun src/index.ts | bun $(which pino-pretty)
# bun src/index.ts | bun $HOME/.bun/bin/pino-pretty
```

</details>

In the example provided, you're using **`bun`** to execute a TypeScript file and then piping (**`|`**) the output to **`pino-pretty`** which is also being run with **`bun`**. This is assuming that **`bun`** can work as a drop-in replacement for **`node`** in this scenario. However, be cautious with this approach as it might not be applicable for all Nodejs packages or scripts due to compatibility issues.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.yemreak.com/arsiv/programming/how-to-use-any-nodejs-dependened-modules-pino-pretty-pm2-with-bunjs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
