Skip to content

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.

Enable auto-install per service by setting autoInstall: true:

services:
- name: My API
command: node
args: [server.js]
port: 3000
autoInstall: true

When enabled, Auto-Install:

  1. Monitors stderr for missing module errors (e.g., Cannot find module 'express')
  2. Stops the failing service
  3. Runs npm install in the service’s working directory
  4. Restarts the service automatically
  • 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
📦 Auto-installing packages (attempt 1/3)...
Error detected: Cannot find module 'express'
✅ Packages installed successfully
🔄 Restarting service after package installation...

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);
}
}
}
};

✅ Enable for:

  • Development services with changing dependencies
  • Rapid prototyping
  • Local development environments

❌ Disable for:

  • Production services
  • Services with locked dependencies
  • Stable, tested code
  • Verify autoInstall: true is set
  • Check cwd points to directory with package.json
  • Ensure npm is installed
  • Check service logs for npm error details
  • Verify package.json exists in service’s cwd
  • Manually run npm install to debug
⚠️ 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.