21 Commits

Author SHA1 Message Date
0xmrpeter
1ff14957ad fix: show node binary path in check_node output for easier debugging
Display the resolved path from 'command -v node' alongside the version
so users and logs immediately show which node is active (e.g. nvm vs
system). Also bump installer version to 1.0.3.
2026-04-07 23:43:57 +07:00
0xmrpeter
91c2a672d5 fix: prefer nvm over system node and check node_modules write access
Two related bugs caused npm install -g to fail with EACCES on machines
where both system node and nvm-managed node are installed:

1. ensure_default_node_active_shell returned early when system node met
   the minimum version requirement, never sourcing nvm. This caused the
   installer to use system npm (prefix /usr/local, root-owned) instead
   of nvm's npm which has a user-writable prefix.

2. fix_npm_permissions checked -w $prefix/lib which can be writable on
   Intel Macs with Homebrew (/usr/local/lib is user-owned) while
   /usr/local/lib/node_modules remains root-owned from a prior pkg
   install. The check now targets node_modules specifically.
2026-04-07 23:42:53 +07:00
0xmrpeter
e8702a15fb fix: call fix_npm_permissions before both npm and git install paths
fix_npm_permissions was only called in the npm install branch, but the
git install path also runs `npm install -g pnpm` as a fallback when
corepack is unavailable. On macOS with Homebrew/system Node, this would
fail with EACCES for the same reason as the main npm install.

Move fix_npm_permissions to run unconditionally before the install
method branch so both paths benefit from the permission fix.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 22:54:19 +07:00
0xmrpeter
bbc5b275bc fix: apply npm permissions fix on macOS, not just Linux
fix_npm_permissions() was guarded with `[[ "$OS" != "linux" ]]`, so it
was a no-op on macOS. Users with Node installed via Homebrew or a system
installer have /usr/local/lib/node_modules owned by root, causing EACCES
on `npm install -g`. Remove the OS guard so the function reconfigures npm
to use ~/.npm-global on any platform where the prefix is not writable.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 22:52:45 +07:00
0xmrpeter
2084c587e2 fix: activate node via nvm/fnm before check_node in non-login shells
When the install script runs in a non-login shell (e.g. launched from
a GUI app), PATH-based node managers like nvm are not initialized.
Call ensure_default_node_active_shell before check_node so that an
already-installed node is discovered without triggering a redundant
install_node call.
2026-04-07 16:42:53 +07:00
0xmrpeter
3d57f94e8e fix(install): detect nvm without NVM_DIR set in non-login shells
When launched from a GUI app (e.g. OpenACP Desktop), the shell is
non-login so ~/.zshrc is never sourced and NVM_DIR is unset — even
if nvm is properly installed. ensure_default_node_active_shell now
falls back to ~/.nvm/nvm.sh and $XDG_CONFIG_HOME/nvm/nvm.sh when
NVM_DIR is not in the environment.
2026-04-06 19:12:26 +07:00
0xmrpeter
33af0a98c7 fix(install): detect Homebrew Node in non-login shells
When the installer runs as 'bash install.sh' or 'curl | bash', the shell
is non-login and non-interactive — ~/.zprofile is never sourced, so
Homebrew's /opt/homebrew/bin (Apple Silicon) or /usr/local/bin (Intel)
is missing from PATH. This caused 'command -v node' to return nothing even
when Node 20+ was already installed via Homebrew.

Two changes:
- Init Homebrew shellenv at the very top of the script (before any checks),
  so the full PATH is available for all subsequent commands.
- Add Homebrew path fallback in ensure_default_node_active_shell as a
  belt-and-suspenders guard for cases where early init was skipped.
2026-04-06 18:31:58 +07:00
0xmrpeter
43c16dff4b chore: bump installer version to 1.0.2
- Updated the installer version in install.sh from 1.0.1 to 1.0.2 for consistency.
- Ensured shell configuration files are patched idempotently during Node.js installation, improving robustness across environments.
2026-04-03 15:13:18 +07:00
0xmrpeter
b55aa151db chore: bump installer version to 1.0.1
- Updated the installer version in both install.ps1 and install.sh scripts from 1.0.0 to 1.0.1, ensuring consistency across platforms.
2026-04-03 15:10:02 +07:00
0xmrpeter
f9c58cb2a2 fix: ensure ~/.zshrc exists before patching on macOS
- Updated the install.sh script to create ~/.zshrc if it does not exist, ensuring that the nvm installer can properly append necessary configurations.
- Enhanced the logic to patch both zsh and bash configuration files, improving the robustness of the installation process on macOS.
2026-04-03 15:09:30 +07:00
0xmrpeter
11a9e18bb0 chore: remove versioning from installer script commands in README and scripts
- Updated installation commands in README.md and scripts to remove version query parameters, simplifying the usage instructions for macOS, Linux, and PowerShell scripts.
2026-04-03 15:04:31 +07:00
0xmrpeter
fdf4fba7a3 chore: update installer scripts to version 1.0.0
- Modified installation commands in README.md to include versioning for macOS, Linux, and PowerShell scripts.
- Updated install.ps1 and install.sh scripts to define and display the installer version as 1.0.0, enhancing clarity for users.
2026-04-03 15:02:18 +07:00
0xmrpeter
aee454f2f7 refactor: enhance nvm installation script for macOS and PATH handling
- Simplified the logic for patching shell configuration files on macOS, ensuring ~/.zshrc is patched automatically and providing a safety net for other configurations.
- Improved PATH handling by skipping directories already present in the original PATH or within the nvm prefix, reducing unnecessary modifications.
- Added a user prompt to open a new terminal after nvm installation to ensure proper loading of nvm in the current session.
2026-04-03 14:58:37 +07:00
0xmrpeter
71411ca905 refactor: improve nvm shell configuration patching logic
- Enhanced the patch_nvm_shell_configs function to ensure nvm initialization lines are added to the appropriate shell configuration files based on the operating system.
- On macOS, it now always patches ~/.zshrc and checks for existing bash configurations, while on Linux, it patches existing files or creates ~/.bashrc if none are present.
- This change improves the robustness of the installation script by ensuring proper nvm setup across different environments.
2026-04-03 14:55:31 +07:00
0xmrpeter
ee4518af2e feat: add nvm shell configuration patching to install script
- Implemented a function to ensure nvm initialization lines are added to relevant shell configuration files (.bashrc, .zshrc, .bash_profile).
- The function checks for existing entries to avoid duplication and creates a .zshrc if none of the config files exist.
- This enhancement improves the user experience by ensuring nvm is properly set up across different shell environments on macOS.
2026-04-03 14:49:21 +07:00
0xmrpeter
93c5aea626 fix(install): auto-detect and install Xcode CLT on macOS before nvm 2026-04-03 10:39:34 +07:00
0xmrpeter
e300e7d605 refactor(docs): update installation instructions and requirements in README; modify Node.js version check in install scripts 2026-04-03 10:26:57 +07:00
0xmrpeter
d9d3fab470 fix: correct date format in version validation comment in install script 2026-04-01 13:58:03 +07:00
0xmrpeter
3380faa4df docs: update plugin commands for consistency and clarity
- Changed 'plugins' to 'plugin' in installation, configuration, enabling, and disabling commands for uniformity.
- Updated Node.js version requirements in install script to reflect the minimum supported version.
2026-03-31 15:40:09 +07:00
Mr.Peter
9c9dd5a785
fix(install): address code review issues in install scripts (#172)
- Add accepted-risk comment for NodeSource curl|bash pattern (HTTPS enforced)
- Fix wrapper script to use printf %q to safely handle special chars in repo_dir
- Add validate_args() to reject unsafe chars and path traversal in --git-dir/--version
- Add npm retry logic (3x, 2s delay) to install.ps1 to match install.sh behavior
- Fix nvm detection: replace unreliable command -v nvm with NVM_DIR/nvm.sh checks
- Add git re-check after install_git() with clear error if installation failed
- Fix PowerShell Add-ToPath null-safety for PATH on fresh installs
- Replace echo -e with printf %b to avoid flag misinterpretation in prompt_choice

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-31 10:04:01 +07:00
lngdao
1a6a27269d
feat(install): add one-liner install scripts for macOS/Linux/Windows (#170)
* feat(install): add macOS/Linux one-liner install script

* docs: add one-liner install commands to Quick Start

* feat(install): add Windows PowerShell installer

* fix(install): update taglines
2026-03-31 09:58:57 +07:00