The `is-running` package provides a minimalist and direct utility for Node.js environments to ascertain if a process with a specific Process ID (PID) is currently active on the system. As of its latest stable release, `2.1.0`, the library focuses on a single, clear function: returning a boolean indicating the presence of a process for a given PID. The package maintains a stable, albeit infrequent, release cadence, with its core functionality having remained consistent since its last major update. Its primary differentiator lies in its extreme simplicity and lack of external dependencies for runtime, making it a lightweight choice for basic process monitoring or cleanup tasks, especially when compared to more comprehensive process management libraries that offer broader control and information beyond just status checks.
npm install is-runningVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to import and use the `is-running` function to check the status of a process by its PID, including a cross-platform example for common system processes and a check for a non-existent PID.
For CommonJS projects, use `const isrunning = require('is-running');`. For ESM projects, consider dynamic import `import('is-running').then(mod => mod.default(pid))` or ensure your build setup correctly handles CommonJS module imports.Ensure the Node.js process has appropriate permissions to query system process tables. For critical applications, wrap calls in `try-catch` blocks and implement robust error handling and logging.
Avoid using `is-running` to determine the existence of privileged or critical system processes (like PID 0 or 4 on Windows) for the purpose of termination or manipulation. Focus on userland processes or processes started by your application.
Ensure you are importing the default export correctly: `const isrunning = require('is-running');` or `import isrunning from 'is-running';` (for ESM-enabled environments).For `is-running`, it's a CommonJS module, so `require('is-running')` is the correct method. If you are in an ESM context (`"type": "module"` in `package.json`), `import isrunning from 'is-running';` should work due to Node.js interoperability, but if not, consider `const isrunning = await import('is-running').then(mod => mod.default);` or review your `tsconfig.json` for `esModuleInterop`.No dependency data recorded yet.