{"id":14824,"library":"ps-node","title":"Node.js Process Lookup Utility","description":"ps-node is a Node.js module designed for looking up and managing running processes across different operating systems. It leverages native system commands like `ps` on Linux/macOS and `wmic` on Windows to retrieve detailed process information, including PID, command, and arguments. The package, currently at version 0.1.6, was last published nine years ago. Its primary functionality includes searching for processes by PID or filtering by command and arguments using regular expressions. Additionally, it offers a `kill` function to terminate processes, supporting optional signals and timeouts. Due to its age, it does not support modern Node.js features like ECMAScript Modules (ESM) and is likely incompatible with recent Node.js versions or major operating system updates. There is no ongoing release cadence, and it is largely superseded by more actively maintained alternatives.","status":"abandoned","version":"0.1.6","language":"javascript","source_language":"en","source_url":"git://github.com/neekey/ps","tags":["javascript","ps","process","lookup","pid"],"install":[{"cmd":"npm install ps-node","lang":"bash","label":"npm"},{"cmd":"yarn add ps-node","lang":"bash","label":"yarn"},{"cmd":"pnpm add ps-node","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used internally to parse the output from system commands like `ps` and `wmic`.","package":"table-parser"}],"imports":[{"note":"The package was published before widespread ESM adoption. While `require` is shown in examples, modern Node.js applications using ESM should use `import ps from 'ps-node'` for CJS interoperability. Direct named ESM imports are not supported.","wrong":"const ps = require('ps-node');","symbol":"ps","correct":"import ps from 'ps-node';"}],"quickstart":{"code":"const ps = require('ps-node');\n\n// Look up processes matching a command and arguments\nps.lookup({\n    command: 'node',\n    arguments: '--debug'\n}, function(err, resultList) {\n    if (err) {\n        console.error('Error looking up processes:', err);\n        process.exit(1);\n    }\n\n    if (resultList.length === 0) {\n        console.log('No matching processes found.');\n        return;\n    }\n\n    console.log('Found matching processes:');\n    resultList.forEach(function(process) {\n        console.log('  PID: %s, COMMAND: %s, ARGUMENTS: %s', process.pid, process.command, process.arguments);\n    });\n\n    // Example: Kill the first found process after 5 seconds (for demonstration)\n    if (resultList[0]) {\n        const pidToKill = resultList[0].pid;\n        console.log(`\nAttempting to kill process ${pidToKill} in 5 seconds...`);\n        setTimeout(() => {\n            ps.kill(pidToKill, { signal: 'SIGTERM', timeout: 10 }, function(killErr) {\n                if (killErr) {\n                    console.error(`Error killing process ${pidToKill}:`, killErr);\n                } else {\n                    console.log(`Process ${pidToKill} has been killed!`);\n                }\n            });\n        }, 5000);\n    }\n});","lang":"javascript","description":"This quickstart demonstrates how to use `ps-node` to find running Node.js processes with specific debug arguments and then, as an example, attempts to terminate the first matching process."},"warnings":[{"fix":"Consider using more modern and actively maintained alternatives like `ps-list` or `systeminformation` for process management in Node.js.","message":"The package is severely outdated (last updated 9 years ago) and may not function correctly on modern Node.js versions (e.g., Node.js v16+) or current operating systems due to changes in internal Node.js APIs or external command outputs.","severity":"breaking","affected_versions":"<=0.1.6"},{"fix":"Thoroughly test on all target operating systems and versions. For production-critical applications, consider implementing fallback mechanisms or using a more robust native solution if available.","message":"The module relies on parsing the output of external shell commands (`ps` on *nix, `wmic` on Windows). Any changes to the output format or flags of these commands by the operating system could break `ps-node`'s functionality, leading to incorrect or missing process information.","severity":"gotcha","affected_versions":"<=0.1.6"},{"fix":"Always use string representations for signals when calling `ps.kill()` (e.g., `ps.kill(pid, 'SIGKILL', callback)`).","message":"The `kill` function wraps `process.kill()` and explicitly states that Node.js's built-in `process.kill()` does not accept numbers as signals, only strings (e.g., 'SIGKILL', 'SIGTERM'). Passing a numeric signal will result in an error or unexpected behavior.","severity":"gotcha","affected_versions":"<=0.1.6"},{"fix":"For Windows, carefully test the output accuracy of `command` and `arguments`. If precise command-line arguments are critical, `ps-node` might not be the most reliable solution, and a different library or direct `wmic`/`tasklist` invocation might be necessary. Note that some versions of `ps-node` (or forks) might concatenate command and arguments into a single string.","message":"The `command` and `arguments` options in `ps.lookup` for Windows environments might have limited functionality or miss full command arguments due to `wmic` limitations, or changes in how `tasklist` works (which is mentioned as an alternative but not directly used by default for arguments).","severity":"deprecated","affected_versions":"<=0.1.6"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Ensure that the `ps` command (on Linux/macOS) or `wmic` (on Windows) is installed and accessible in the system's PATH. Check execution permissions for the Node.js process. On Windows, ensure `cmd` is available.","cause":"The `ps` command (or `wmic`/`cmd` on Windows) is not found in the system's PATH, or there are permission issues executing it.","error":"Error: spawn ps ENOENT"},{"fix":"This package is not maintained, so direct fixes are unlikely. The best solution is to migrate to a more current process management library or implement custom parsing for the specific OS if `ps-node` is absolutely required.","cause":"The output format of the underlying `ps` or `wmic` command has changed, or `table-parser` is unable to correctly parse the output, often due to unexpected characters or column shifts.","error":"Error: (some error message from underlying shell command output) -- parsing error"},{"fix":"Verify that the PID is correct and that the target process is still running. Ensure the Node.js application has the necessary permissions to send signals to other processes on the operating system.","cause":"The process with the specified PID does not exist, or the Node.js process attempting to kill it does not have sufficient permissions.","error":"Error: kill ESRCH"}],"ecosystem":"npm"}