Skip to content

Commit c61113e

Browse files
committed
feat(node): update Node.js to v20 LTS and add v22 LTS support
- Update .nvmrc to v20.19.3 (LTS Iron) - Add support for Node.js v22 LTS (Jod) in CI matrix - Update minimum Node.js version to v20.0.0 in package.json - Add NODE-VERSION.md documenting LTS support and features - Update all documentation files to reflect new version requirements
1 parent a0bea9d commit c61113e

File tree

9 files changed

+230
-16
lines changed

9 files changed

+230
-16
lines changed

.github/workflows/lint.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ jobs:
1010
lint:
1111
name: Lint and Format Check
1212
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
node-version: ['20.19.3', '22.17.0'] # Test with both Node.js v20 LTS and v22 LTS
16+
fail-fast: false
1317
steps:
1418
- name: Checkout code
1519
uses: actions/checkout@v4
@@ -22,10 +26,10 @@ jobs:
2226
version: 8.15.4 # Using the version from packageManager in package.json
2327
run_install: false
2428

25-
- name: Setup Node.js
29+
- name: Setup Node.js ${{ matrix.node-version }}
2630
uses: actions/setup-node@v4
2731
with:
28-
node-version: '20.3.0'
32+
node-version: ${{ matrix.node-version }}
2933
cache: 'pnpm'
3034

3135
- name: Install dependencies

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20.3.0
1+
20.19.3

CI.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The CI workflow is defined in `.github/workflows/lint.yml` and performs the foll
1010

1111
1. **Checkout Code**: Fetches the repository code with full history for proper lockfile validation
1212
2. **Setup pnpm**: Installs the pnpm package manager (version 8.15.4)
13-
3. **Setup Node.js**: Configures Node.js environment (version 20.3.0) with pnpm caching
13+
3. **Setup Node.js**: Configures Node.js environment (version 22.17.0 LTS) with pnpm caching
1414
4. **Install Dependencies**: Installs project dependencies using pnpm
1515
5. **Check Formatting**: Verifies code formatting using Biome
1616
6. **Run Linting**: Performs code linting using Biome
@@ -26,10 +26,12 @@ The CI workflow is configured to handle the pnpm lockfile (`pnpm-lock.yaml`) pro
2626

2727
### Node.js Version
2828

29-
The project requires Node.js version 20.3.0 or higher, which is specified in:
29+
The project supports both Node.js v20 LTS and v22 LTS versions, which is specified in:
3030

31-
- `package.json` via the `engines` field
32-
- `.nvmrc` file for local development with nvm
31+
- `package.json` via the `engines` field (set to `>=20.0.0`)
32+
- `.nvmrc` file for local development with nvm (set to `20.19.3` by default)
33+
34+
Both Node.js v20 LTS (Iron) and v22 LTS (Jod) are fully supported. For more information on Node.js version requirements and benefits of using LTS versions, see [NODE-VERSION.md](./NODE-VERSION.md).
3335

3436
## Troubleshooting CI Issues
3537

CONTRIBUTING.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,12 @@ export const toolName: Tool = {
6464

6565
### Prerequisites
6666

67-
- Node.js (v20.3.0 or newer)
67+
- Node.js LTS:
68+
- v20 LTS (v20.0.0 or newer, default v20.19.3)
69+
- v22 LTS (v22.0.0 or newer, also supported v22.17.0)
6870
- pnpm (v8.0.0 or newer)
6971

70-
> **Note:** This project requires pnpm as the package manager. We recommend using Corepack (built into Node.js 20+) to manage pnpm:
72+
> **Note:** This project requires pnpm as the package manager. We recommend using Corepack (built into Node.js) to manage pnpm:
7173
> ```sh
7274
> # Enable Corepack
7375
> corepack enable
@@ -76,7 +78,7 @@ export const toolName: Tool = {
7678
> corepack prepare pnpm@latest --activate
7779
> ```
7880
>
79-
> For more details on our package manager and Node.js requirements, see [PACKAGE-MANAGER.md](./PACKAGE-MANAGER.md).
81+
> For more details on our package manager and Node.js requirements, see [PACKAGE-MANAGER.md](./PACKAGE-MANAGER.md) and [NODE-VERSION.md](./NODE-VERSION.md).
8082
8183
### Setup Steps
8284
@@ -96,6 +98,10 @@ export const toolName: Tool = {
9698
# Alternative: If you have network issues with Corepack
9799
npm install -g [email protected]
98100
pnpm install
101+
102+
# Note: Ensure you're using Node.js v22 LTS
103+
# Check your version with: node -v
104+
# If needed, install the LTS version from nodejs.org
99105
```
100106

101107
> If you encounter network issues with Corepack during git operations, see the [Troubleshooting section in PACKAGE-MANAGER.md](./PACKAGE-MANAGER.md#troubleshooting).

LOCKFILE-MANAGEMENT.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,42 @@ Common causes:
4343
2. Different pnpm versions generating incompatible lockfiles
4444
3. Merge conflicts in the lockfile that weren't properly resolved
4545

46+
### ERR_PNPM_UNSUPPORTED_ENGINE
47+
48+
This error occurs when there's a mismatch between your Node.js version and what a dependency requires. The error message looks like:
49+
50+
```
51+
ERR_PNPM_UNSUPPORTED_ENGINE Unsupported environment (bad pnpm and/or Node.js version)
52+
53+
Your Node version is incompatible with "<package-name>".
54+
55+
Expected version: <expected-version-range>
56+
Got: <your-version>
57+
```
58+
59+
Common causes:
60+
1. Using a Node.js version that's incompatible with a dependency's requirements
61+
2. Dependencies requiring newer Node.js versions than specified in your project
62+
3. Outdated dependencies with strict Node.js version requirements
63+
64+
#### Example: nopt Package Requirements
65+
66+
A common example is the `nopt` package (used by many development tools) which requires:
67+
```
68+
^18.17.0 || >=20.5.0
69+
```
70+
71+
If your project uses Node.js v20.3.0 but has dependencies that use `[email protected]` (directly or indirectly), you'll encounter this error. The solution is to update your Node.js version to v20.5.0 or higher.
72+
73+
### Using LTS Versions
74+
75+
This project now uses Node.js v22 LTS (codename 'Jod'), which provides several benefits for dependency management:
76+
77+
1. **Longer support window**: LTS versions receive security updates and bug fixes for a longer period (30 months total)
78+
2. **Wider compatibility**: Most npm packages are tested against LTS versions first
79+
3. **Fewer dependency conflicts**: LTS versions have more stable APIs, reducing the likelihood of compatibility issues
80+
4. **Predictable upgrade path**: Clear timeline for when to plan the next major version upgrade
81+
4682
## Best Practices
4783

4884
### For Local Development
@@ -75,6 +111,8 @@ Common causes:
75111
76112
## Troubleshooting
77113
114+
### Lockfile Issues
115+
78116
If you encounter lockfile issues:
79117
80118
1. **Update your local environment**:
@@ -101,6 +139,44 @@ If you encounter lockfile issues:
101139
git commit -m "Update lockfile"
102140
```
103141

142+
### Node.js Version Issues
143+
144+
If you encounter `ERR_PNPM_UNSUPPORTED_ENGINE` errors:
145+
146+
1. **Check your Node.js version**:
147+
```bash
148+
node -v
149+
```
150+
151+
2. **Update Node.js to the required LTS version**:
152+
- If using nvm:
153+
```bash
154+
# Install the required LTS version
155+
nvm install 22.17.0 # Current LTS version
156+
157+
# Use the installed version
158+
nvm use 22.17.0
159+
```
160+
- If using Corepack (recommended):
161+
```bash
162+
# Enable Corepack if not already enabled
163+
corepack enable
164+
165+
# Update Node.js using your system's package manager or from nodejs.org
166+
```
167+
- If using other Node.js installation methods, download and install the LTS version from [nodejs.org](https://nodejs.org/)
168+
169+
3. **Update project configuration** (if necessary):
170+
- Update `.nvmrc` to specify the LTS Node.js version (currently 22.17.0)
171+
- Update `engines` field in `package.json` to require Node.js >=22.0.0
172+
- Consider adding a note in your README about using the LTS version
173+
174+
4. **Reinstall dependencies with the correct Node.js version**:
175+
```bash
176+
rm -rf node_modules
177+
pnpm install
178+
```
179+
104180
## Additional Resources
105181

106182
- [pnpm Documentation on Lockfile](https://pnpm.io/lockfile)

NODE-VERSION.md

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
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)

PACKAGE-MANAGER.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,21 @@ This project enforces specific requirements for the development environment to e
88

99
### Node.js Version
1010

11-
- **Minimum required version**: v20.3.0
12-
- **Recommended version**: v22.x (LTS)
11+
- **Minimum required version**: v20.0.0
12+
- **Recommended versions**:
13+
- v20.19.3 (LTS - Iron) - Default version in .nvmrc
14+
- v22.17.0 (LTS - Jod) - Also fully supported
1315

14-
This requirement is based on Astro's compatibility with Node.js versions. Astro 5.x requires Node.js v20.3.0 or higher.
16+
This project supports both current LTS (Long Term Support) versions of Node.js for maximum stability and security:
17+
18+
- **Node.js v20 LTS (Iron)**: Active support until April 2025, maintenance until April 2026
19+
- **Node.js v22 LTS (Jod)**: Active support until October 2025, maintenance until April 2027
20+
21+
Benefits of using the LTS version:
22+
1. Longer support window with security updates
23+
2. Greater stability for production environments
24+
3. Compatibility with the latest dependencies
25+
4. Performance improvements over previous versions
1526

1627
### Package Manager
1728

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,12 @@ Frontend Tools Explorer is a curated collection of essential tools, libraries, a
4545

4646
### Prerequisites
4747

48-
- Node.js (v20.3.0 or newer)
48+
- Node.js LTS:
49+
- v20 LTS (v20.0.0 or newer, default v20.19.3)
50+
- v22 LTS (v22.0.0 or newer, also supported v22.17.0)
4951
- pnpm (v8.0.0 or newer)
5052

51-
> **Note:** This project requires specific Node.js and package manager versions. For more details, see [PACKAGE-MANAGER.md](./PACKAGE-MANAGER.md).
53+
> **Note:** This project requires specific Node.js and package manager versions. For more details, see [PACKAGE-MANAGER.md](./PACKAGE-MANAGER.md) and [NODE-VERSION.md](./NODE-VERSION.md).
5254
5355
### Installation
5456

@@ -70,6 +72,10 @@ Frontend Tools Explorer is a curated collection of essential tools, libraries, a
7072
# Alternative: If you have network issues with Corepack
7173
npm install -g [email protected]
7274
pnpm install
75+
76+
# Note: Ensure you're using Node.js v22 LTS
77+
# Check your version with: node -v
78+
# If needed, install the LTS version from nodejs.org
7379
```
7480

7581
> **Note:** This project requires pnpm as the package manager. We recommend using Corepack (built into Node.js 20+) to manage pnpm. See [PACKAGE-MANAGER.md](./PACKAGE-MANAGER.md) for more details and troubleshooting.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "module",
44
"version": "0.0.1",
55
"engines": {
6-
"node": ">=20.3.0",
6+
"node": ">=20.0.0",
77
"pnpm": ">=8.0.0"
88
},
99
"packageManager": "[email protected]",

0 commit comments

Comments
 (0)