wait-on is a robust, cross-platform utility available as both a command-line interface (CLI) and a Node.js programmatic API, designed to pause execution until specified resources become available or unavailable. Its current stable version is 9.0.5, with minor patch releases addressing dependency updates and bug fixes, while major versions primarily align with Node.js LTS lifecycle. It differentiates itself by supporting a wide array of resource types including local files, TCP ports, Unix domain sockets, and HTTP(s) endpoints, with advanced features like waiting for files to stop growing (useful for build processes) and a 'reverse mode' to await resource unavailability. This makes it particularly suited for orchestrating tasks in CI/CD pipelines, development environments, and service startup/shutdown sequences where precise timing and resource readiness are crucial.
npm install wait-onVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to programmatically use `wait-on` in TypeScript to await the creation of a local file and the availability of a TCP port and an HTTP endpoint before proceeding with further application logic.
Upgrade your Node.js runtime to version 20, 22, 24, or newer LTS releases to ensure compatibility with wait-on v9.x. Check https://nodejs.org/en/about/releases/ for current LTS versions.
For HTTP GET requests, use `http-get://your-server/path` or `https-get://your-server/path` instead of `http://` or `https://`.
Always explicitly specify the resource type prefix (e.g., `file:`, `http:`, `tcp:`, `socket:`) to avoid ambiguity and ensure correct behavior.
Adjust the `window` option (e.g., `window: 750` ms) to a value suitable for your file write patterns, ensuring `wait-on` waits for the file size to stabilize for that duration before considering it 'available'.
Upgrade `wait-on` to the latest stable version (9.0.5 or newer) to ensure all dependency patches, including security fixes for `axios`, are applied.
Increase the `timeout` option in your programmatic usage or the `--timeout` flag in CLI. Verify that the resources (file paths, ports, URLs) are correct and that the services they represent are actually starting up.
If installed locally, run `npx wait-on ...` or ensure `node_modules/.bin` is in your PATH. If you intend global use, install with `npm install -g wait-on`.
Check the URL for typos. Ensure the target server is running, accessible from where `wait-on` is executed, and that no firewall is blocking the connection.
Ensure you are using the correct ESM import: `import waitOn from 'wait-on';` or CommonJS: `const waitOn = require('wait-on');`. Confirm `wait-on` is installed correctly.No dependency data recorded yet.