This package provides a minimal utility to programmatically determine if the current JavaScript execution environment is Node.js. It achieves this by checking for the presence of the global `process` object and specific properties like `process.versions.node`. The current stable version is 1.1.1. The package maintains a relatively active release cadence, primarily for patch updates related to build processes (e.g., `npm ignore`). Its key differentiator is its singular focus and small footprint, offering a straightforward boolean value rather than a complex function or object. It's commonly employed in isomorphic libraries or application code that needs to adapt behavior between server-side Node.js and client-side browser environments.
npm install is-nodeVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to import and use the `is-node` boolean to conditionally execute code, logging environment-specific details depending on whether the current runtime is Node.js.
For highly critical environment checks, consider more comprehensive or multi-factor detection strategies beyond `is-node` alone, or explicitly check for `process.versions.node` directly if that is the specific property your logic relies on.
Upgrade to `is-node@1.1.0` or later to leverage built-in TypeScript definitions and ensure proper type inference for the `isNode` boolean.
If your application requires more granular environment detection (e.g., 'is in browser', 'is in Deno', 'is in Electron main/renderer'), use dedicated libraries or custom checks for those specific environments instead of relying solely on `is-node`.
Do not attempt to call `isNode`. Use it directly as a boolean condition, e.g., `if (isNode) { /* ... */ }`.Change the import statement to a default import: `import isNode from 'is-node';`.
Ensure your build process correctly handles Node.js-specific code for different targets. If this error occurs in a browser environment, verify `is-node` itself is evaluating to `false` and that other Node.js assumptions are not present.
No dependency data recorded yet.