# 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.
