Upgrade Node.js 12 to 18 Safely

A safe, step-by-step Node version upgrade workflow for production services.

category:modernization
node
runtime
upgrade
workflow
multi-step
0

Prompt

Use this workflow when upgrading a service from Node 12 to 18. Follow each step, verifying behavior with tests and canary deploys before rolling out globally.

## Steps:

1. Audit current Node APIs used (fs, crypto, http, timers, etc.) and list potentially deprecated patterns.

2. Update the engines field in package.json to require Node 18.

3. Run the codebase under Node 18 locally and capture any runtime warnings or errors.

4. Replace deprecated or legacy fs and crypto APIs with their modern equivalents.

5. Run dependency checks to ensure core libraries support Node 18.

6. Update CI pipelines and Docker base images to use Node 18.

7. Run full test suite plus smoke tests against staging environment.

8. Roll out to production with a monitored canary deployment.