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.
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.
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>
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>
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.
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.
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.
- 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.
- 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.
- Updated installation commands in README.md and scripts to remove version query parameters, simplifying the usage instructions for macOS, Linux, and PowerShell scripts.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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>