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 # Function to install Node.js
install_nodejs() { install_nodejs() {
if get_user_confirmation "Node.js installieren?"; then if get_user_confirmation "Node.js installieren?"; then
if command_exists node; then log_info "Node.js wird installiert/aktualisiert..."
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 # Install npm first
npm install -g npm@latest apt install -y npm
log_success "Node.js wurde erfolgreich installiert." # Update npm to latest version
log_info "Installed Node.js version: $(node --version)" npm install -g npm@latest
log_info "Installed npm version: $(npm --version)"
fi # 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 else
log_skip "Node.js-Installation übersprungen." log_skip "Node.js-Installation übersprungen."
fi fi
@ -175,9 +179,8 @@ display_system_overview() {
if command_exists ufw; then if command_exists ufw; then
echo "✓ UFW ($(ufw status | grep Status | cut -d' ' -f2))" echo "✓ UFW ($(ufw status | grep Status | cut -d' ' -f2))"
fi fi
echo -e "\n${BLUE}[Open Ports]${NC}" 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" echo -e "\n${GREEN}Setup completed! System is ready to use.${NC}\n"
} }