Skip to content

Use NodeSource LTS repositories for reliable Node.js 20+ bootstrap on Linux#28

Merged
ChangeHow merged 4 commits intofeat/sync-local-zsh-configfrom
copilot/sub-pr-27
Mar 22, 2026
Merged

Use NodeSource LTS repositories for reliable Node.js 20+ bootstrap on Linux#28
ChangeHow merged 4 commits intofeat/sync-local-zsh-configfrom
copilot/sub-pr-27

Conversation

Copy link
Contributor

Copilot AI commented Mar 22, 2026

Installing Node.js via default apt-get/dnf/yum packages often yields outdated versions that fail the >= 20 version gate, breaking fresh-machine installs. The existing skip-if-present logic was already correct; only the installation path needed fixing.

Changes

  • install.shensure_node_runtime: For apt-get and dnf/yum, run the official NodeSource LTS setup script before installing nodejs, replacing the bare distro-package install:

    apt-get)
      log "Adding NodeSource LTS repository..."
      if ! curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -; then
        echo "Failed to set up NodeSource repository for Node.js." >&2
        exit 1
      fi
      install_with_manager "${manager}" nodejs
      ;;

    Using setup_lts.x ensures the latest LTS release is always installed rather than pinning to a specific major version. The minimum required version remains Node.js 20. Both Linux branches include explicit error handling on the setup script so failures surface with a clear message rather than a confusing downstream install error. Installation is skipped entirely when node and npm are already present at a compatible version (>= 20).

  • tests/install-script.test.js: Two new tests — one asserting the skip-if-node >= 20-present guard, one asserting the NodeSource LTS URLs (setup_lts.x) and | sudo -E bash - pattern are present for both Debian and RPM targets.


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI changed the title [WIP] [WIP] Address feedback on quick init support for fresh machines Use NodeSource repositories for reliable Node.js 18+ bootstrap on Linux Mar 22, 2026
Copilot AI requested a review from ChangeHow March 22, 2026 01:37
@ChangeHow
Copy link
Owner

不是,哥们,别用 node18,至少要求 node20 @copilot

@ChangeHow ChangeHow marked this pull request as ready for review March 22, 2026 01:41
Co-authored-by: ChangeHow <23733347+ChangeHow@users.noreply.github.com>
Agent-Logs-Url: https://github.com/ChangeHow/suitup/sessions/4dc0df07-50ce-4a7c-8cc7-9f713eba218d
Copy link
Contributor Author

Copilot AI commented Mar 22, 2026

不是,哥们,别用 node18,至少要求 node20 @copilot

已改为 Node.js 20:NodeSource URL 改为 setup_20.x,版本门槛改为 -ge 20,所有错误提示也同步更新。commit: 00d3da3

install.sh Outdated
apt-get)
install_with_manager "${manager}" nodejs npm
log "Adding NodeSource repository for Node.js 18..."
if ! curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -; then
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

最好提供 lts 的下载,然后这里有检查本地是否安装 node 吗? @copilot

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已改用 setup_lts.x(deb 和 rpm 都改了),commit: a06c39a

本地已有检查:ensure_node_runtime 开头先检测 nodenpm 是否存在且版本 >= 20,满足则直接 return 0 跳过安装,不会重复安装。

Copilot AI changed the title Use NodeSource repositories for reliable Node.js 18+ bootstrap on Linux Use NodeSource repositories for reliable Node.js 20+ bootstrap on Linux Mar 22, 2026
Copilot AI requested a review from ChangeHow March 22, 2026 01:44
Copilot AI changed the title Use NodeSource repositories for reliable Node.js 20+ bootstrap on Linux Use NodeSource LTS repositories for reliable Node.js 20+ bootstrap on Linux Mar 22, 2026
@ChangeHow ChangeHow merged commit 43fa6de into feat/sync-local-zsh-config Mar 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants