How to fix npm ERR! code ELIFECYCLE npm ERR! errno 143 npm ERR! Exit status 143 in npm

npmINTERMEDIATEMEDIUMUpdated Dec 6, 2025· 185 views

Exit code 143 means your process received SIGTERM—a graceful termination signal. This happens during Docker stops, Kubernetes pod termination, or CI timeouts. Run Node.js directly instead of through npm to handle signals properly.

Quick fix

Fixes ELIFECYCLE

# Instead of:
CMD ["npm", "start"]

# Use:
CMD ["node", "server.js"]
  1. Run Node.js directly instead of through npm
  2. Add signal handlers to your app
  3. Use a process manager for production
  4. Increase Kubernetes grace period if needed
npm — error
# Instead of:
CMD ["npm", "start"]
# Use:
CMD ["node", "server.js"]
npm ERR! code ELIFECYCLE
npm ERR! errno 143
npm ERR! Exit status 143

What this error means

Exit code 143 is calculated as 128 + 15 (SIGTERM signal number). It means your process received a termination signal—typically a graceful shutdown request from the system. This commonly occurs when: - Docker stops a container (`docker stop`) - Kubernetes terminates a pod - A CI/CD system times out a job - A process manager restarts your app The "problem" is that npm doesn't properly forward SIGTERM to your Node.js process. Instead, npm catches the signal and kills its children immediately, resulting in exit code 143 rather than a graceful shutdown.

Typical symptoms

  • Exit code 143 when stopping Docker containers
  • Kubernetes pods show exit code 143 on termination
  • CI/CD pipeline fails with SIGTERM error
  • npm start exits with 143 during deployments
  • Graceful shutdown handlers don't run
  • Process killed during rolling deployments

Common causes

  1. Container or orchestrator sending SIGTERM
  2. CI/CD system timing out the job
  3. Process manager restarting the application
  4. System shutdown or resource reclamation
  5. Memory pressure causing system to terminate processes
  6. Running Node.js through npm instead of directly

How to fix "npm ERR! code ELIFECYCLE npm ERR! errno 143 npm ERR! Exit status 143"

1Run Node.js directly instead of through npm

The root cause is npm not forwarding signals properly. In production:

dockerfile
# Instead of:
CMD ["npm", "start"]

# Use:
CMD ["node", "server.js"]

This makes Node.js the top-level process, allowing it to handle SIGTERM directly.

2Add signal handlers to your app

Handle SIGTERM at the very top of your entry file:

javascript
process.on('SIGTERM', () => {
  console.log('SIGTERM received, shutting down gracefully');
  // Close database connections, finish requests, etc.
  server.close(() => {
    process.exit(0);
  });
});

Place this before any blocking operations.

3Use a process manager for production

npm is not designed for production process management. Use:

bash
# PM2
pm2 start server.js

# Or run directly
node server.js

Process managers handle signals properly and provide restart capabilities.

4Increase Kubernetes grace period if needed

Kubernetes sends SIGTERM, then waits (default 30s) before SIGKILL:

yaml
spec:
  terminationGracePeriodSeconds: 60

Ensure your app can shut down within this window.

5Check Docker stop timeout

Docker's default stop timeout is 10 seconds:

bash
# Increase timeout
docker stop --time=30 container_name

Or in docker-compose.yml:

yaml
services:
  app:
    stop_grace_period: 30s

Advanced notes

Signal exit codes:
- 130 (128+2): SIGINT (Ctrl+C)
- 137 (128+9): SIGKILL (forced termination, no grace period)
- 143 (128+15): SIGTERM (graceful termination request)

If you see 137 instead of 143, your process didn't shut down in time and was forcefully killed.

For Node.js apps, a proper graceful shutdown includes:

javascript
const server = app.listen(3000);

process.on('SIGTERM', () => {
  console.log('SIGTERM received');

  server.close(() => {
    console.log('HTTP server closed');
    // Close database connections
    db.close(() => {
      console.log('Database connection closed');
      process.exit(0);
    });
  });

  // Force close after 30s
  setTimeout(() => {
    console.error('Forced shutdown');
    process.exit(1);
  }, 30000);
});

Frequently asked questions

What does "ELIFECYCLE" mean?
Exit code 143 is calculated as 128 + 15 (SIGTERM signal number). It means your process received a termination signal—typically a graceful shutdown request from the system. js process.
How do I fix "ELIFECYCLE"?
Exit code 143 means your process received SIGTERM—a graceful termination signal. This happens during Docker stops, Kubernetes pod termination, or CI timeouts. Run Node.js directly instead of through npm to handle signals properly.
What causes "ELIFECYCLE"?
Container or orchestrator sending SIGTERM CI/CD system timing out the job Process manager restarting the application
Is the "ELIFECYCLE" error serious?
It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.

Official resources & further reading