vx-tool-node
Node.js tool support for the vx universal tool manager.
Overview
vx-tool-node provides Node.js runtime support for vx, enabling automatic installation, version management, and execution of Node.js and npm commands through the vx interface.
Features
- Node.js Runtime: Full Node.js runtime support with version management
- NPM Integration: Built-in npm package manager support
- NPX Support: Package runner functionality for one-time tool execution
- Auto-Installation: Automatic download and installation of Node.js versions
- Cross-Platform: Windows, macOS, and Linux support
- Version Management: Install and switch between multiple Node.js versions
- LTS Support: Automatic detection and installation of LTS versions
Supported Commands
Node.js Runtime
# Execute Node.js scripts
# Interactive REPL
NPM Package Manager
# Package management
# Project management
# Information commands
NPX Package Runner
# Run packages without installing
# Run specific versions
Installation
Through vx CLI
# Install latest LTS version
# Install specific version
# Install latest version
Version Constraints
# Semantic version ranges
Configuration
Project Configuration (.vx.toml)
[]
= "18.17.0" # Specific version
# node = "lts" # Latest LTS
# node = "latest" # Latest stable
# node = "^18.0.0" # Version range
[]
= true
= true # Install npm alongside Node.js
Global Configuration
[]
= "lts"
= true
= 300
= true
[]
= "https://registry.npmjs.org/"
= "~/.npm"
Version Management
Available Versions
The plugin supports all official Node.js releases:
- LTS Versions: 18.x, 20.x (recommended for production)
- Current Versions: Latest stable releases
- Legacy Versions: 16.x and older (limited support)
Version Detection
# List available versions
# Show current version
# Show installation path
Platform Support
Windows
- x64: Full support
- x86: Legacy support
- ARM64: Windows 11 ARM support
macOS
- x64: Intel Mac support
- ARM64: Apple Silicon (M1/M2) support
- Universal: Automatic architecture detection
Linux
- x64: All major distributions
- ARM64: ARM-based systems
- ARMv7: Raspberry Pi and similar
Integration
With vx-core
use ;
use NodeTool;
let node_tool = new;
let manager = new;
// Install Node.js
manager.install_tool.await?;
// Execute Node.js
manager.execute_tool.await?;
Plugin Registration
use ;
use NodePlugin;
let plugin = new;
let mut manager = new;
manager.register_plugin?;
Development
Building
Testing
Integration Testing
# Test with actual Node.js installation
Implementation Details
Tool Structure
- NodeTool: Main Node.js runtime tool
- NpmTool: NPM package manager integration
- NpxTool: NPX package runner support
Version Resolution
- Project Config: Check
.vx.tomlfor version specification - Global Config: Fall back to global default
- LTS Detection: Use latest LTS if no version specified
- Auto-Install: Download and install if not available
Installation Process
- Version Lookup: Query Node.js release API
- Download: Fetch appropriate binary/installer
- Extraction: Extract to vx tools directory
- Verification: Verify installation integrity
- NPM Setup: Configure npm if included
Error Handling
Common Errors
- Network Issues: Download failures, API timeouts
- Permission Errors: Installation directory access
- Version Conflicts: Multiple Node.js installations
- Corruption: Incomplete or corrupted downloads
Recovery
# Reinstall corrupted version
# Clear cache and retry
# Use system Node.js as fallback
Performance
- Fast Downloads: Parallel downloading with progress tracking
- Efficient Storage: Shared installations across virtual environments
- Quick Execution: Minimal overhead for tool execution
- Smart Caching: Version metadata and download caching
Security
- Checksum Verification: SHA256 verification of downloads
- HTTPS Only: Secure downloads from official sources
- Signature Validation: GPG signature verification (when available)
- Sandboxed Execution: Isolated execution environments
Troubleshooting
Installation Issues
# Check available versions
# Verify network connectivity
# Check disk space
# Force reinstall
Runtime Issues
# Check Node.js installation
# Verify PATH configuration
# Test with system Node.js
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please see the contributing guidelines for more information.
Related Crates
vx-core- Core functionalityvx-cli- Command-line interfacevx-pm-npm- NPM package managervx-tool-uv- UV Python tool