Auto-Install
DevAll includes an Auto-Install core plugin that automatically detects missing Node.js modules and installs them when services crash with module errors.
Quick Start
Section titled “Quick Start”Enable auto-install per service by setting autoInstall: true:
services: - name: My API command: node args: [server.js] port: 3000 autoInstall: true{ "services": [ { "name": "My API", "command": "node", "args": ["server.js"], "port": 3000, "autoInstall": true } ]}import { defineConfig } from 'devall/config';
export default defineConfig({ services: [ { name: "My API", command: "node", args: ["server.js"], port: 3000, autoInstall: true } ]});How It Works
Section titled “How It Works”When enabled, Auto-Install:
- Monitors stderr for missing module errors (e.g.,
Cannot find module 'express') - Stops the failing service
- Runs
npm installin the service’s working directory - Restarts the service automatically
Safety Features
Section titled “Safety Features”- Retry Limit: Max 3 attempts within a 3-minute window
- Loop Prevention: Stops if service fails immediately after installation
- Opt-In Only: Disabled by default - must explicitly enable per service
Dashboard Messages
Section titled “Dashboard Messages”📦 Auto-installing packages (attempt 1/3)...Error detected: Cannot find module 'express'
✅ Packages installed successfully🔄 Restarting service after package installation...Plugin Implementation
Section titled “Plugin Implementation”Auto-Install is a core plugin located at plugins/autoinstall/index.js:
export default { name: 'autoinstall',
hooks: { 'log:error': async (service, errorMessage, context) => { if (!service.autoInstall) return;
if (isMissingModuleError(errorMessage)) { await context.processes.stop(service.id); // Run npm install... await context.processes.start(service.id); } } }};When to Use
Section titled “When to Use”✅ Enable for:
- Development services with changing dependencies
- Rapid prototyping
- Local development environments
❌ Disable for:
- Production services
- Services with locked dependencies
- Stable, tested code
Troubleshooting
Section titled “Troubleshooting”Auto-install not running?
Section titled “Auto-install not running?”- Verify
autoInstall: trueis set - Check
cwdpoints to directory withpackage.json - Ensure npm is installed
Installation fails?
Section titled “Installation fails?”- Check service logs for npm error details
- Verify
package.jsonexists in service’scwd - Manually run
npm installto debug
Limit reached?
Section titled “Limit reached?”⚠️ Auto-install limit reached (3 attempts in 3 minutes). Please fix manually.This means the issue is not a missing dependency. Check service logs for the real error.
Related
Section titled “Related”- Create Plugin - Build custom plugins
- Configuration - Service configuration options