# nodexh

> a wrapper around the `node` executable for better stacktraces with sourcemaps, sourcecode excerpts

Latest version **4.2.0** (published 2026-01-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install nodexh
pnpm add nodexh
yarn add nodexh
bun add nodexh
```

Provides the command `nodexh`.

## Health

**Score 45/100 (D)** — status: stable.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 4.2.0 |
| Published | 2026-01-20 |
| First published | 2020-06-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 15.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | loveencounterflow |
| Keywords | node, stacktrace, terminal, error handling |

## Links

- npm: https://www.npmjs.com/package/nodexh
- Repository: https://github.com/loveencounterflow/nodexh
- Issues: https://github.com/loveencounterflow/nodexh/issues
- npm.io page: https://npm.io/package/nodexh

## Dependencies (1)

- [bricabrac-sfmodules](https://npm.io/package/bricabrac-sfmodules.md) ^0.21.0

## Alternatives

- [@sentry/react-native](https://npm.io/package/@sentry/react-native.md) — 2.6M weekly downloads
- [@ardatan/aggregate-error](https://npm.io/package/@ardatan/aggregate-error.md) — 708.1K weekly downloads
- [custom-error-generator](https://npm.io/package/custom-error-generator.md) — 2.0K weekly downloads
- [@technik-sde/prosemirror-recreate-transform](https://npm.io/package/@technik-sde/prosemirror-recreate-transform.md) — 1.5K weekly downloads
- [@suchipi/error-utils](https://npm.io/package/@suchipi/error-utils.md) — 78 weekly downloads

## Recent versions

- 4.2.0 (latest) — 2026-01-20
- 4.1.1 — 2025-11-24
- 4.1.0 — 2025-11-17
- 4.0.2 — 2025-11-15
- 4.0.1 — 2025-08-26
- 4.0.0 — 2025-08-26
- 3.2.0 — 2025-08-16
- 3.1.0 — 2024-09-17
- 3.0.0 — 2024-07-05
- 2.2.2 — 2023-09-01
- 2.2.1 — 2023-08-29
- 2.2.0 — 2022-12-09
- 2.1.1 — 2022-06-11
- 2.1.0 — 2022-01-22
- 2.0.0 — 2021-08-14
- … 7 more at https://npm.io/package/nodexh/versions

## README

# NodeXH: NodeJS With a Better Exception Handler

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents**  *generated with [DocToc](https://github.com/thlorenz/doctoc)*

- [What It Is](#what-it-is)
- [How to Install](#how-to-install)
- [How to Use](#how-to-use)
- [What to Expect](#what-to-expect)
- [Related](#related)
- [To Do](#to-do)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

## What It Is

NodeXH is a drop-in wrapper for the NodeJS executable hat provides better stacktraces.

## How to Install

`npm install -g nodexh`

## How to Use

Use `nodexh path/to/file.js` instead of `node path/to/file.js`, and you're good to go.

## What to Expect

* Stack trace items will be reversed, so most recent calls will be shown *last*, i.e. also closest to where
  the cursor of your terminal is.
* Stack traces will show source contexts (3 lines by default) except where files can not be opened or are
  NodeJS internals.
* Source code shown will honor sourcemaps, which is great when you're using the likes of CoffeeScript or
  TypeScript.
* The error message will be repeated to avoid having to scroll up when stack traces get longer.
* Colors!

## Related

* https://github.com/mozilla/source-map/
* https://sokra.github.io/source-map-visualization/
* https://medium.com/@nodejs/source-maps-in-node-js-482872b56116:
  * "In v13.7.0 a public API was introduced for interacting with source
    maps."—[link](https://nodejs.org/dist/latest-v14.x/docs/api/all.html#modules_source_map_v3_support)
  * "You can start using Node.js’ source map functionality today: make sure you have an up-to-date version
    of Node.js installed, and run your programs with the flag --enable-source-maps."

## To Do

* [ ] Add `error.name`, `error.code`; where `node` reports `TypeError: TEMPLATES.main_2 is not a function`,
  `nodexh` only reports `EXCEPTION: TEMPLATES.main_2 is not a function`
* [ ] visually indicate spot of error (e.g. by reversing)
* [ ] fix async stacktraces (probably not yet handled correctly; might be issue with `stackman`?)
* [ ] consider [utf8ize-sourcemaps](https://github.com/twada/utf8ize-sourcemaps) in case there should be
  problems w/ 32bit characters
* [ ] truncate long lines in context
* [ ] offer capabilities of NodeXH as API so applications (such as test libraries) can easily retrieve
  source code, display source lines with contexts

---
_Source: https://npm.io/package/nodexh · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
