Registry / devops / runtime-node-refresh

runtime-node-refresh

JSON →
library1.0.7jsnpmunverified

runtime-node-refresh (RnR) is a lightweight JavaScript utility designed to update Node.js environment variables (`process.env`) at runtime without requiring a server restart. Currently at version 1.0.7, it appears to have an infrequent release cadence given its focused scope as a 'tiny lib'. Its core mechanism relies on Node.js signals, specifically `SIGPIPE`, to communicate between different Node.js processes, enabling one process to trigger an update in another. This differentiation allows for dynamic configuration changes in long-running applications, such as adjusting log levels or feature flags without service interruption. It's particularly useful for production environments where restarts are costly, but crucially, it does not support Worker threads due to its reliance on inter-process signals.

npm install runtime-node-refresh
INSTALL
IMPORT
SIG · RUNTIME-NODE-REFRE
R
runtime-node-refresh
devopsjavascriptv1.0.7
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

RnR
import RnR from 'runtime-node-refresh';
const RnR = require('runtime-node-refresh');
The library primarily uses ESM syntax. While Node.js's CJS interop might work in some contexts, explicit ESM import is recommended.
Command Line Tool
npm run refresh
The package installs a CLI tool named 'runtime-node-refresh' which can be invoked via npm scripts, as shown in the quickstart example, to trigger the environment refresh in a running application.

This quickstart demonstrates how to initialize `runtime-node-refresh` in a Node.js application and then trigger an environment variable update from a separate process using the `runtime-node-refresh` CLI tool.

/* index.js */ import RnR from 'runtime-node-refresh'; process.env.LOG_LEVEL = 'error'; RnR(() => { process.env.LOG_LEVEL = 'debug'; console.log('Environment variables refreshed!'); }); setInterval(() => console.log(`The LOG_LEVEL is set to ${process.env.LOG_LEVEL}`), 3000); /* package.json (relevant scripts and dependencies) */ { "name": "test-rnr", "scripts": { "start": "node index.js", "refresh": "runtime-node-refresh" }, "dependencies": { "runtime-node-refresh": "^1.0.7" } } // To run: // Terminal 1: npm start // Terminal 2: npm run refresh
Debug
Known issues
gotcharuntime-node-refresh relies on Node.js signals and does not function correctly with Worker threads.
fix
Avoid using `runtime-node-refresh` for `process.env` updates that need to be visible or processed within Node.js Worker threads. Consider alternative configuration management strategies for multi-threaded applications.
affects: >=1.0.0
gotchaThe library utilizes the `SIGPIPE` signal for inter-process communication. If your application has an existing `SIGPIPE` listener, it may interfere with RnR's functionality.
fix
Before integrating `runtime-node-refresh`, verify that your Node.js application does not have a custom `SIGPIPE` signal handler. If one exists, you may need to remove it or adjust its logic to allow RnR to function as intended.
affects: >=1.0.0
Errors
Common errors & fixes
Refresh command did not update environment variables in the target application.
The Node.js server intended to receive the refresh signal was either not running, or the `RnR` initialization function was not properly called to listen for updates.
fix
Ensure the target Node.js application is running and has `RnR(() => { /* update logic */ });` correctly implemented. This callback registers the listener for refresh events.
Application crashes or behaves unexpectedly after calling `runtime-node-refresh` CLI or `RnR` function.
A conflict with an existing `SIGPIPE` signal handler in the application is causing unintended behavior or an unhandled exception.
fix
Check for any custom `process.on('SIGPIPE', ...)` listeners in your codebase. `runtime-node-refresh` expects `SIGPIPE` to be handled specifically by its internal mechanisms (Node.js ignores `SIGPIPE` by default). Remove or reconfigure conflicting listeners.
Upgrade
Version history
1.0.7latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
OpenAI (training)
1
Resources
runtime-node-refresh — npm install runtime-node-refresh · libregistry