Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,39 @@ Memory comparison between standard Node.js 22 and pointer-compressed Node.js 25
| `@napi-rs/uuid` | Rust N-API | ✓ Works |
| `@node-rs/argon2` | Rust N-API | ✓ Works |

**Non-N-API native addons may crash.** Addons using the older V8 native addon API (like `better-sqlite3`) are not compatible with pointer compression and will segfault. Always prefer N-API-based alternatives.
**Non-N-API native addons may crash.** Addons using the older V8 native addon API (like `better-sqlite3`) are not compatible with pointer compression and can segfault. Packages that rely on `nan` are especially affected. Always prefer N-API-based alternatives.

### Workarounds for Non-N-API Addons

If your dependency uses `nan` and does not provide binaries built for this runtime, you must force a local rebuild of its native addon.

If the package in `node_modules` still contains source files, try a normal rebuild:

```bash
cd node_modules/<package-name>
pnpm install --ignore-scripts
pnpm run rebuild
```

Some packages on npm do not ship source files needed to rebuild. In these cases, you may need to fetch the source from the git repository, copy it back into `node_modules`, and run a manual rebuild.

#### Known affected package example

##### `@datadog/pprof`
Comment thread
ShogunPanda marked this conversation as resolved.

This was tested against [@datadog/pprof](https://www.npmjs.com/package/@datadog/pprof) 5.13.5.

```bash
cd node_modules/@datadog/pprof
pnpm install --ignore-scripts
PPROF_VERSION=$(node -p "require('./package.json').version")
PPROF_REPO=$(node -p "require('./package.json').repository.url.replace('git+', '')")
git clone -q --depth=1 --branch=v$PPROF_VERSION $PPROF_REPO /tmp/pprof-nodejs > /dev/null 2>&1
mv /tmp/pprof-nodejs/{binding.gyp,bindings} .
rm -rf /tmp/pprof-nodejs
pnpm run rebuild
cd ../../..
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this really work? Doesn't pprof use node-gyp to build which in turn is also a nan dependency? doesn't node-gyp also need to be rebuilt?

```

## How It Works

Expand Down