|
| 1 | +# Node.js Version Requirements |
| 2 | + |
| 3 | +This project supports both Node.js v20 LTS (codename 'Iron') and Node.js v22 LTS (codename 'Jod') to ensure stability, security, and access to modern features. This document explains our Node.js version requirements and how to set up your environment. |
| 4 | + |
| 5 | +### What is LTS? |
| 6 | + |
| 7 | +LTS stands for "Long Term Support." The Node.js project maintains multiple release lines simultaneously: |
| 8 | + |
| 9 | +- **Current**: The latest features but may have breaking changes (odd-numbered versions like v23) |
| 10 | +- **Active LTS**: Stable release recommended for most users (even-numbered versions like v20 and v22) |
| 11 | +- **Maintenance LTS**: Older LTS versions receiving critical fixes only |
| 12 | + |
| 13 | +Our supported LTS versions have the following support schedules: |
| 14 | + |
| 15 | +- **Node.js v20 (Iron)**: Entered LTS on October 24, 2023, with active support until April 2025, followed by maintenance support until April 2026. |
| 16 | +- **Node.js v22 (Jod)**: Entered LTS on October 29, 2024, with active support until October 2025, followed by maintenance support until April 2027. |
| 17 | + |
| 18 | +### Benefits of Using LTS |
| 19 | + |
| 20 | +1. **Stability**: LTS versions prioritize stability over new features, making them ideal for production applications |
| 21 | +2. **Security**: LTS versions receive security updates for a longer period (30 months total) |
| 22 | +3. **Compatibility**: Most npm packages are tested against LTS versions first |
| 23 | +4. **Performance**: Each LTS version includes performance improvements over previous versions |
| 24 | +5. **Predictable upgrade path**: Clear timeline for when to plan the next major version upgrade |
| 25 | + |
| 26 | +### Supported LTS Features |
| 27 | + |
| 28 | +#### Node.js v20 LTS (Iron) Features |
| 29 | + |
| 30 | +1. **Permission Model**: Enhanced security with the experimental permission model |
| 31 | +2. **Single Executable Applications**: Improved support for creating standalone executables |
| 32 | +3. **Stable Test Runner**: Built-in test runner for easier testing |
| 33 | +4. **Stable WebStreams**: Improved streaming capabilities |
| 34 | +5. **V8 JavaScript Engine**: Includes V8 11.3 with performance improvements |
| 35 | + |
| 36 | +#### Node.js v22 LTS (Jod) Features |
| 37 | + |
| 38 | +1. **Built-in WebSocket Client**: Now enabled by default for browser compatibility |
| 39 | +2. **Stable Watch Mode**: The `--watch` flag is now stable, eliminating the need for tools like nodemon |
| 40 | +3. **ESM Graphs in require()**: Simplified module interoperability |
| 41 | +4. **Simplified Script Execution**: The experimental `--run` flag provides faster script execution |
| 42 | +5. **V8 Engine Upgrade**: Improved performance and new JavaScript features |
| 43 | + |
| 44 | +## Version Requirements |
| 45 | + |
| 46 | +- **Minimum required version**: v20.0.0 |
| 47 | +- **Recommended versions**: |
| 48 | + - v20.19.3 (LTS - Iron) - Default version in .nvmrc |
| 49 | + - v22.17.0 (LTS - Jod) - Also fully supported |
| 50 | + |
| 51 | +## Setting Up the Correct Version |
| 52 | + |
| 53 | +### Using nvm (Node Version Manager) |
| 54 | + |
| 55 | +```bash |
| 56 | +# Install the default LTS version (v20 LTS - Iron) |
| 57 | +nvm install 20.19.3 |
| 58 | + |
| 59 | +# Use the installed version |
| 60 | +nvm use 20.19.3 |
| 61 | + |
| 62 | +# Or install and use Node.js v22 LTS (Jod) |
| 63 | +nvm install 22.17.0 |
| 64 | +nvm use 22.17.0 |
| 65 | +``` |
| 66 | + |
| 67 | +### Using Corepack (Recommended) |
| 68 | + |
| 69 | +```bash |
| 70 | +# Enable Corepack if not already enabled |
| 71 | +corepack enable |
| 72 | + |
| 73 | +# Update Node.js using your system's package manager or from nodejs.org |
| 74 | +``` |
| 75 | + |
| 76 | +### Direct Installation |
| 77 | + |
| 78 | +Download and install the LTS version from [nodejs.org](https://nodejs.org/). |
| 79 | + |
| 80 | +## Troubleshooting |
| 81 | + |
| 82 | +If you encounter version-related issues: |
| 83 | + |
| 84 | +1. Check your current Node.js version: |
| 85 | + ```bash |
| 86 | + node -v |
| 87 | + ``` |
| 88 | + |
| 89 | +2. If using nvm, ensure you're using one of the supported LTS versions: |
| 90 | + ```bash |
| 91 | + # For Node.js v20 LTS (default) |
| 92 | + nvm use 20 |
| 93 | + |
| 94 | + # Or for Node.js v22 LTS |
| 95 | + nvm use 22 |
| 96 | + ``` |
| 97 | + |
| 98 | +3. If you cannot upgrade to a supported version immediately, you can try using the `--no-engine-strict` flag with pnpm: |
| 99 | + ```bash |
| 100 | + pnpm install --no-engine-strict |
| 101 | + ``` |
| 102 | + Note: This is not recommended for long-term use. |
| 103 | + |
| 104 | +## Additional Resources |
| 105 | + |
| 106 | +- [Node.js Release Schedule](https://github.com/nodejs/Release) |
| 107 | +- [Node.js LTS Documentation](https://nodejs.org/en/about/previous-releases) |
| 108 | +- [Package Manager Documentation](./PACKAGE-MANAGER.md) |
| 109 | +- [Lockfile Management](./LOCKFILE-MANAGEMENT.md) |
0 commit comments