node via n

This commit is contained in:
Justin 2025-02-28 08:58:58 +01:00
parent 5ae5b64798
commit d84ac67ffc

View File

@ -106,22 +106,26 @@ install_docker() {
# Function to install Node.js
install_nodejs() {
if get_user_confirmation "Node.js installieren?"; then
if command_exists node; then
log_info "Node.js ist bereits installiert."
else
log_info "Node.js wird installiert..."
apt install -y curl
# Using the latest LTS version (20.x as of now)
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt install -y nodejs
# Install latest npm version
npm install -g npm@latest
log_success "Node.js wurde erfolgreich installiert."
log_info "Installed Node.js version: $(node --version)"
log_info "Installed npm version: $(npm --version)"
fi
log_info "Node.js wird installiert/aktualisiert..."
# Install npm first
apt install -y npm
# Update npm to latest version
npm install -g npm@latest
# Install n module for Node.js version management
npm install -g n
# Install latest stable Node.js version using n
n stable
# Reload shell environment to use new Node.js version
export PATH="$PATH"
log_success "Node.js wurde erfolgreich installiert/aktualisiert."
log_info "Installed Node.js version: $(node --version)"
log_info "Installed npm version: $(npm --version)"
else
log_skip "Node.js-Installation übersprungen."
fi
@ -175,9 +179,8 @@ display_system_overview() {
if command_exists ufw; then
echo "✓ UFW ($(ufw status | grep Status | cut -d' ' -f2))"
fi
echo -e "\n${BLUE}[Open Ports]${NC}"
netstat -tuln | grep LISTEN | awk '{print $4}' | sed 's/.*://'
netstat -tuln | grep LISTEN | awk '{print $4}' | sed 's/.*://' | tr '\n' ', ' | sed 's/,$/\n/'
echo -e "\n${GREEN}Setup completed! System is ready to use.${NC}\n"
}