For recording Node processes, Replay provides the @replayio/node npm package which can be used to execute and record a script.

Getting setup

npm i @replayio/node --global

replay-node script-name.js
RECORD_REPLAY_API_KEY=YOUR-KEY npx @replayio/replay view-latest

Note: This will prompt you to install @replayio/replay if you haven’t already!

Example

Lets say you want to record loop.js

for (let i = 0; i < 5; i++) {
   console.log(`Hello ${i}`)
}

You'd first create the replay with replay-node and then upload it with @replayio/replay:

replay-node loop.js
RECORD_REPLAY_API_KEY=YOUR-KEY npx @replayio/replay view-latest

And once it's uploaded you'd be able to view it at [app.replay.io](<http://app.replay.io>):

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/0371c6a3-68ad-4ecf-90b2-3ffaa4368bc0/Screen_Shot_2021-04-12_at_10.31.25_AM.png

TypeScript

If you want to record a ts-node invocation, invoke replay-node like so

replay-node --exec ts-node ...

Upgrading Node