Skip to content

Commit

Permalink
Merge pull request #1828 from nodesource/jesus/support-23
Browse files Browse the repository at this point in the history
Support node.js v23
  • Loading branch information
JesusPaz authored Oct 17, 2024
2 parents e427823 + 7fcc0f5 commit 9534379
Show file tree
Hide file tree
Showing 13 changed files with 659 additions and 131 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
version: [18, 20, 21, 22]
version: [18, 20, 22, 23]
os: ["ubuntu:24.04", "ubuntu:22.04", "debian:10"]
container:
image: ${{ matrix.os }}
Expand Down Expand Up @@ -48,7 +48,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
version: [18, 20, 21, 22]
version: [18, 20, 22, 23]
os: ["fedora:36", "amazonlinux:2023", "rockylinux:9", "redhat/ubi9:latest"]
container:
image: ${{ matrix.os }}
Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
version: [18, 20, 21, 22]
version: [18, 20, 22, 23]
os: ["rockylinux:9-minimal", "redhat/ubi9-minimal:latest"]
container:
image: ${{ matrix.os }}
Expand Down
185 changes: 159 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,28 +58,95 @@ NodeSource will continue to maintain the following architectures and may add add

#### **Ubuntu versions**

| Distro Name | Node 18x | Node 20x | Node 21x | Node 22x |
| :------------------- | :------: | :------: | :------: | :------: |
| Ubuntu Bionic ^18.04 |||||
| Ubuntu Focal ^20.04 |||||
| Ubuntu Jammy ^22.04 |||||
| Ubuntu Noble ^24.04 |||||
| Distro Name | Node 18x | Node 20x | Node 21x | Node 22x | Node 23x |
| :------------------- | :------: | :------: | :------: | :------: | :------: |
| Ubuntu Bionic ^18.04 ||||||
| Ubuntu Focal ^20.04 ||||||
| Ubuntu Jammy ^22.04 ||||||
| Ubuntu Noble ^24.04 ||||||

#### **Debian versions**

| Distro Name | Node 18x | Node 20x | Node 21x | Node 22x |
| :----------------- | :------: | :------: | :------: | :------: |
| Debian 8 Jessie |||||
| Debian 9 Stretch |||||
| Debian 10 Buster |||||
| Debian 11 Bullseye |||||
| Debian 12 Bookworm |||||
| Distro Name | Node 18x | Node 20x | Node 21x | Node 22x | Node 23x |
| :----------------- | :------: | :------: | :------: | :------: | :------: |
| Debian 8 Jessie ||||||
| Debian 9 Stretch ||||||
| Debian 10 Buster ||||||
| Debian 11 Bullseye ||||||
| Debian 12 Bookworm ||||||

> [!NOTE]
> If you are looking to run Node.js in a non-supported Linux version [contact NodeSource](https://nodesource.com/pages/contact-us.html) to get enterprise support for your specific needs.
### Installation Instructions (DEB)

**Node.js 23.x**:

##### Using Ubuntu (Node.js 23)

Before you begin, ensure that `curl` is installed on your system. If `curl` is not installed, you can install it using the following command:

```sh
sudo apt-get install -y curl
```

1. **Download the setup script:**

```sh
curl -fsSL https://deb.nodesource.com/setup_23.x -o nodesource_setup.sh
```

2. **Run the setup script with sudo:**

```sh
sudo -E bash nodesource_setup.sh
```

3. **Install Node.js:**

```sh
sudo apt-get install -y nodejs
```

4. **Verify the installation:**

```sh
node -v
```

##### Using Debian, as root (Node.js 23)

Before you begin, ensure that `curl` is installed on your system. If `curl` is not installed, you can install it using the following command:

```sh
apt-get install -y curl
```

1. **Download the setup script:**

```sh
curl -fsSL https://deb.nodesource.com/setup_23.x -o nodesource_setup.sh
```

2. **Run the setup script with sudo:**

```sh
bash nodesource_setup.sh
```

3. **Install Node.js:**

```sh
apt-get install -y nodejs
```

4. **Verify the installation:**

```sh
node -v
```


**Node.js 22.x**:

##### Using Ubuntu (Node.js 22)
Expand Down Expand Up @@ -464,7 +531,7 @@ apt-get install -y curl
```
</details>

**Node.js Current (22)**:
**Node.js Current (23)**:

##### Using Ubuntu (Node.js Current)

Expand Down Expand Up @@ -572,20 +639,20 @@ NodeSource will continue to maintain the following architectures and may add add

#### **Fedora versions**

| Distro Name | Node 18x | Node 20x | Node 21x | Node 22x |
| :-------------------- | :------: | :------: | :------: | :------: |
| Fedora >= 20 (20->28) |||||
| Fedora >= 29 |||||
| Fedora >= 36 |||||
| Distro Name | Node 18x | Node 20x | Node 21x | Node 22x | Node 23x |
| :-------------------- | :------: | :------: | :------: | :------: | :------: |
| Fedora >= 20 (20->28) ||||||
| Fedora >= 29 ||||||
| Fedora >= 36 ||||||

#### **Redhat versions**

| Distro Name | Node 18x | Node 20x | Node 21x | Node 22x |
|:-----------------| :------: | :------: | :------: | :------: |
| Redhat 7 |||||
| Redhat 8 |||||
| Redhat 9 |||||
| Redhat 9-minimal |||||
| Distro Name | Node 18x | Node 20x | Node 21x | Node 22x | Node 23x |
|:-----------------| :------: | :------: | :------: | :------: | :------: |
| Redhat 7 ||||||
| Redhat 8 ||||||
| Redhat 9 ||||||
| Redhat 9-minimal ||||||

#### **Amazon Linux versions**

Expand All @@ -601,6 +668,72 @@ NodeSource will continue to maintain the following architectures and may add add

### Installation Instructions (RPM)

**Node.js v23.x**

##### Using RPM-based Systems (Node.js 23)

Before you begin, ensure that `curl` is installed on your system. If `curl` is not installed, you can install it using the following command:

```sh
sudo yum install -y curl
```

1. **Download the setup script:**

```sh
curl -fsSL https://rpm.nodesource.com/setup_23.x -o nodesource_setup.sh
```

2. **Run the setup script as root:**

```sh
sudo bash nodesource_setup.sh
```

3. **Install Node.js:**

```sh
sudo yum install -y nodejs
```

4. **Verify the installation:**

```sh
node -v
```

##### No root privileges (Node.js 23)

Before you begin, ensure that `curl` is installed on your system. If `curl` is not installed, you can install it using the following command:

```sh
yum install -y curl
```

1. **Download the setup script:**

```sh
curl -fsSL https://rpm.nodesource.com/setup_23.x -o nodesource_setup.sh
```

2. **Run the setup script as root:**

```sh
bash nodesource_setup.sh
```

3. **Install Node.js:**

```sh
yum install -y nodejs
```

4. **Verify the installation:**

```sh
node -v
```

**Node.js v22.x**

##### Using RPM-based Systems (Node.js 22)
Expand Down Expand Up @@ -985,7 +1118,7 @@ sudo yum install -y curl
```
</details>

**Node.js Current (22.x)**
**Node.js Current (23.x)**

##### As root (Node.js Current)

Expand Down
4 changes: 2 additions & 2 deletions scripts/deb/script_generator/generator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if [ ! -f "$base_script" ]; then
fi

# List of versions
versions=("18" "20" "21" "22")
versions=("18" "20" "22" "23")

# Iterate over the versions and create scripts
for version in "${versions[@]}"; do
Expand All @@ -34,7 +34,7 @@ done

# Define LTS and current Node.js versions
lts_version="20"
current_version="22"
current_version="23"

# Create setup_lts and setup_current scripts
create_script "$lts_version" "lts"
Expand Down
113 changes: 113 additions & 0 deletions scripts/deb/setup_23.x
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
#!/bin/bash

# Logger Function
log() {
local message="$1"
local type="$2"
local timestamp=$(date '+%Y-%m-%d %H:%M:%S')
local color
local endcolor="\033[0m"

case "$type" in
"info") color="\033[38;5;79m" ;;
"success") color="\033[1;32m" ;;
"error") color="\033[1;31m" ;;
*) color="\033[1;34m" ;;
esac

echo -e "${color}${timestamp} - ${message}${endcolor}"
}

# Error handler function
handle_error() {
local exit_code=$1
local error_message="$2"
log "Error: $error_message (Exit Code: $exit_code)" "error"
exit $exit_code
}

# Function to check for command availability
command_exists() {
command -v "$1" &> /dev/null
}

check_os() {
if ! [ -f "/etc/debian_version" ]; then
echo "Error: This script is only supported on Debian-based systems."
exit 1
fi
}

# Function to Install the script pre-requisites
install_pre_reqs() {
log "Installing pre-requisites" "info"

# Run 'apt-get update'
if ! apt-get update -y; then
handle_error "$?" "Failed to run 'apt-get update'"
fi

# Run 'apt-get install'
if ! apt-get install -y apt-transport-https ca-certificates curl gnupg; then
handle_error "$?" "Failed to install packages"
fi

if ! mkdir -p /usr/share/keyrings; then
handle_error "$?" "Makes sure the path /usr/share/keyrings exist or run ' mkdir -p /usr/share/keyrings' with sudo"
fi

rm -f /usr/share/keyrings/nodesource.gpg || true
rm -f /etc/apt/sources.list.d/nodesource.list || true

# Run 'curl' and 'gpg' to download and import the NodeSource signing key
if ! curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /usr/share/keyrings/nodesource.gpg; then
handle_error "$?" "Failed to download and import the NodeSource signing key"
fi

# Explicitly set the permissions to ensure the file is readable by all
if ! chmod 644 /usr/share/keyrings/nodesource.gpg; then
handle_error "$?" "Failed to set correct permissions on /usr/share/keyrings/nodesource.gpg"
fi
}

# Function to configure the Repo
configure_repo() {
local node_version=$1

arch=$(dpkg --print-architecture)
if [ "$arch" != "amd64" ] && [ "$arch" != "arm64" ] && [ "$arch" != "armhf" ]; then
handle_error "1" "Unsupported architecture: $arch. Only amd64, arm64, and armhf are supported."
fi

echo "deb [arch=$arch signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$node_version nodistro main" | tee /etc/apt/sources.list.d/nodesource.list > /dev/null

# N|solid Config
echo "Package: nsolid" | tee /etc/apt/preferences.d/nsolid > /dev/null
echo "Pin: origin deb.nodesource.com" | tee -a /etc/apt/preferences.d/nsolid > /dev/null
echo "Pin-Priority: 600" | tee -a /etc/apt/preferences.d/nsolid > /dev/null

# Nodejs Config
echo "Package: nodejs" | tee /etc/apt/preferences.d/nodejs > /dev/null
echo "Pin: origin deb.nodesource.com" | tee -a /etc/apt/preferences.d/nodejs > /dev/null
echo "Pin-Priority: 600" | tee -a /etc/apt/preferences.d/nodejs > /dev/null

# Run 'apt-get update'
if ! apt-get update -y; then
handle_error "$?" "Failed to run 'apt-get update'"
else
log "Repository configured successfully."
log "To install Node.js, run: apt-get install nodejs -y" "info"
log "You can use N|solid Runtime as a node.js alternative" "info"
log "To install N|solid Runtime, run: apt-get install nsolid -y \n" "success"
fi
}

# Define Node.js version
NODE_VERSION="23.x"

# Check OS
check_os

# Main execution
install_pre_reqs || handle_error $? "Failed installing pre-requisites"
configure_repo "$NODE_VERSION" || handle_error $? "Failed configuring repository"
2 changes: 1 addition & 1 deletion scripts/deb/setup_current.x
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ configure_repo() {
}

# Define Node.js version
NODE_VERSION="22.x"
NODE_VERSION="23.x"

# Check OS
check_os
Expand Down
Loading

0 comments on commit 9534379

Please sign in to comment.