fix: refactor setup scripts for system-wide Node.js (no nvm)
BREAKING: Officer now uses system Node.js via NodeSource instead of nvm. Changes: - Removed nvm sourcing from setup.sh - Updated Node installation to use NodeSource repository - All npm global packages installed system-wide with sudo - Updated PTY sidecar setup to use /usr/bin/node (system node) - Added Pi validation (test --list-models) - System packages now available to all users automatically Benefits: - Multi-user friendly: all users get same Node version - No per-user environment setup needed - Simpler troubleshooting (one node version) - Services use consistent node binary - Prevents snap node incompatibility issues Fixes: - 'node not found' for secondary users - systemd services finding correct node - Pi installation consistency across users New Files: - SETUP_GUIDE.md: Comprehensive installation guide - SETUP_ANALYSIS.md: Technical analysis of previous issues Migration: - Remove nvm if installed (optional) - Run: curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - - Run: sudo apt-get install -y nodejs - Run: bash scripts/setup.sh
This commit is contained in:
@@ -18,14 +18,24 @@ SERVICE_FILE="/etc/systemd/system/${SERVICE_NAME}.service"
|
||||
SERVICE_USER="$(whoami)"
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||
NODE_BIN="$(which node)"
|
||||
|
||||
# Use system node (not nvm) for systemd service
|
||||
NODE_BIN="/usr/bin/node"
|
||||
|
||||
if [ ! -f "$NODE_BIN" ]; then
|
||||
fail "System Node.js not found at $NODE_BIN"
|
||||
fail "Install Node.js 22 via NodeSource:"
|
||||
fail " curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -"
|
||||
fail " sudo apt-get install -y nodejs"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "── PTY Sidecar (systemd service) ──"
|
||||
echo " Node: $NODE_BIN ($("$NODE_BIN" -v))"
|
||||
|
||||
if systemctl is-active --quiet "$SERVICE_NAME" 2>/dev/null; then
|
||||
skip "$SERVICE_NAME service already running"
|
||||
echo " Use 'bun run restart:sidecar' to restart"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user