Description
The NodeSource setup script (nsetup) fails to detect TencentOS Server as a supported RHEL-based distribution. This causes Node.js installation to fail entirely on TencentOS, which is a widely used Linux distribution on Tencent Cloud.
The root cause is that the script relies on /etc/redhat-release for RHEL-family detection, but TencentOS Server does not ship this file by default.
Environment
- OS: TencentOS Server V4.4
/etc/os-release (key fields):
NAME="TencentOS Server"
VERSION="4.4"
ID=tencentos
ID_LIKE="tencentos"
VERSION_ID="4.4"
PLATFORM_ID="platform:el9"
- Note:
/etc/redhat-release is NOT present by default
- Arch: x86_64 (also applies to aarch64)
- Package Manager:
dnf (yum compatible)
Steps to Reproduce
# On a fresh TencentOS Server V4.4 instance:
curl -fsSL https://rpm.nodesource.com/setup_22.x | bash -
Result: Script exits with an error because it cannot determine the distribution.
Expected Behavior
TencentOS Server should be recognized as a RHEL/EL9-compatible distribution, and the NodeSource RPM repository should be configured successfully, allowing dnf install -y nodejs to work.
Actual Behavior
The setup script fails at distribution detection. The error occurs because:
- TencentOS does not have
/etc/redhat-release
ID_LIKE in /etc/os-release is "tencentos" instead of "rhel centos fedora"
- The script has no fallback to check
PLATFORM_ID="platform:el9" which clearly indicates EL9 compatibility
Workaround (manual)
# Create the missing file manually:
echo "TencentOS Server release 4.4" > /etc/redhat-release
# Then run the setup script again:
curl -fsSL https://rpm.nodesource.com/setup_22.x | bash -
dnf install -y nodejs
However, this workaround is fragile and should not be required.
Suggested Fix
Add TencentOS to the distribution detection logic. Possible approaches:
Option A: Add tencentos to the ID matching
# In the distribution detection section, add:
tencentos)
# Treat as RHEL-family, use EL version from PLATFORM_ID
;;
Option B: Use PLATFORM_ID as fallback
# If /etc/redhat-release is absent, check PLATFORM_ID:
if [[ "$PLATFORM_ID" == platform:el* ]]; then
# Extract EL version and proceed with RHEL repository
fi
Option B is more robust as it would automatically support other EL-compatible distributions too.
Additional Context
- TencentOS Server is a production Linux distribution maintained by Tencent Cloud, serving millions of instances
- It is fully compatible with the RHEL/CentOS ecosystem (EL9 based)
- Uses
dnf package manager, supports RPM packages
- Official site: https://cloud.tencent.com/product/ts
- This issue was discovered during automated AI usability testing across Linux distributions
Description
The NodeSource setup script (
nsetup) fails to detect TencentOS Server as a supported RHEL-based distribution. This causes Node.js installation to fail entirely on TencentOS, which is a widely used Linux distribution on Tencent Cloud.The root cause is that the script relies on
/etc/redhat-releasefor RHEL-family detection, but TencentOS Server does not ship this file by default.Environment
/etc/os-release(key fields):/etc/redhat-releaseis NOT present by defaultdnf(yum compatible)Steps to Reproduce
Result: Script exits with an error because it cannot determine the distribution.
Expected Behavior
TencentOS Server should be recognized as a RHEL/EL9-compatible distribution, and the NodeSource RPM repository should be configured successfully, allowing
dnf install -y nodejsto work.Actual Behavior
The setup script fails at distribution detection. The error occurs because:
/etc/redhat-releaseID_LIKEin/etc/os-releaseis"tencentos"instead of"rhel centos fedora"PLATFORM_ID="platform:el9"which clearly indicates EL9 compatibilityWorkaround (manual)
However, this workaround is fragile and should not be required.
Suggested Fix
Add TencentOS to the distribution detection logic. Possible approaches:
Option A: Add
tencentosto the ID matchingOption B: Use PLATFORM_ID as fallback
Option B is more robust as it would automatically support other EL-compatible distributions too.
Additional Context
dnfpackage manager, supports RPM packages