Show deprecation warnings
📦 Node.js-> Command Line
✨ The Prompt Phrase
node --trace-deprecation app.js
💻 Code Preview
📦 All-in-One Code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Show deprecation warnings - Interactive Tutorial</title>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700;900&family=Fira+Code:wght@400;500;600&display=swap" rel="stylesheet">
<style>
:root {
--bg-primary: #0a0e27;
--bg-secondary: #151932;
--bg-card: #1e2139;
--accent-purple: #a855f7;
--accent-blue: #3b82f6;
--accent-green: #10b981;
--accent-red: #ef4444;
--accent-yellow: #f59e0b;
--accent-pink: #ec4899;
--accent-cyan: #06b6d4;
--accent-orange: #fb923c;
--text-primary: #f8fafc;
--text-secondary: #94a3b8;
--gradient-warning: linear-gradient(135deg, #f59e0b 0%, #fb923c 100%);
--gradient-trace: linear-gradient(135deg, #fb923c 0%, #ef4444 100%);
--shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Poppins', sans-serif;
background: var(--bg-primary);
color: var(--text-primary);
line-height: 1.6;
overflow-x: hidden;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
.progress-container {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 5px;
background: var(--bg-secondary);
z-index: 1000;
}
.progress-bar {
height: 100%;
background: var(--gradient-warning);
width: 0%;
transition: width 0.3s ease;
}
.hero {
text-align: center;
padding: 100px 20px;
background: var(--gradient-warning);
position: relative;
overflow: hidden;
border-radius: 0 0 50px 50px;
}
.hero::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="2" fill="white" opacity="0.1"/></svg>');
animation: float 20s linear infinite;
}
@keyframes float {
from { transform: translateY(0); }
to { transform: translateY(-100px); }
}
.hero-content {
position: relative;
z-index: 1;
}
.warning-icon {
font-size: 5rem;
margin-bottom: 20px;
animation: warningBlink 2s ease-in-out infinite;
}
@keyframes warningBlink {
0%, 100% { transform: scale(1); opacity: 1; }
50% { transform: scale(1.15); opacity: 0.8; }
}
.command-display {
display: inline-block;
background: rgba(0, 0, 0, 0.4);
padding: 25px 40px;
border-radius: 15px;
font-family: 'Fira Code', monospace;
font-size: 1.1rem;
margin: 30px 0;
border: 3px solid rgba(255, 255, 255, 0.3);
animation: pulse 2s ease-in-out infinite;
color: white;
font-weight: 600;
}
@keyframes pulse {
0%, 100% { transform: scale(1); }
50% { transform: scale(1.05); }
}
.hero h1 {
font-size: 3.5rem;
font-weight: 900;
margin-bottom: 20px;
color: white;
text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}
.hero p {
font-size: 1.4rem;
opacity: 0.95;
color: white;
}
.section {
margin: 60px 0;
}
.section-title {
font-size: 2.5rem;
margin-bottom: 30px;
background: var(--gradient-warning);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
display: inline-block;
font-weight: 700;
}
.card {
background: var(--bg-card);
border-radius: 20px;
padding: 40px;
margin: 30px 0;
box-shadow: var(--shadow);
border: 1px solid rgba(255, 255, 255, 0.05);
transition: transform 0.3s ease;
}
.card:hover {
transform: translateY(-5px);
}
.code-block {
background: #1e1e1e;
border-radius: 15px;
padding: 25px;
margin: 20px 0;
font-family: 'Fira Code', monospace;
position: relative;
}
.code-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15px;
padding-bottom: 15px;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.terminal-dots {
display: flex;
gap: 6px;
}
.terminal-dot {
width: 12px;
height: 12px;
border-radius: 50%;
}
.dot-red { background: #ff5f56; }
.dot-yellow { background: #ffbd2e; }
.dot-green { background: #27c93f; }
.copy-btn {
background: var(--accent-purple);
color: white;
border: none;
padding: 8px 16px;
border-radius: 8px;
cursor: pointer;
font-size: 0.9rem;
transition: all 0.3s ease;
}
.copy-btn:hover {
background: var(--accent-blue);
transform: scale(1.05);
}
.copy-btn.copied {
background: var(--accent-green);
}
pre {
margin: 0;
overflow-x: auto;
}
code {
color: #e0e0e0;
font-size: 0.95rem;
line-height: 1.8;
}
.code-comment { color: #6a9955; }
.code-string { color: #ce9178; }
.code-keyword { color: #569cd6; }
.code-node { color: #f59e0b; font-weight: 600; }
.code-flag { color: #fb923c; font-weight: 600; }
.code-warning { color: #f59e0b; }
.steps {
counter-reset: step-counter;
}
.step {
background: var(--bg-secondary);
border-radius: 15px;
padding: 30px;
margin: 20px 0;
position: relative;
padding-left: 100px;
transition: all 0.3s ease;
}
.step:hover {
background: var(--bg-card);
transform: translateX(10px);
}
.step::before {
counter-increment: step-counter;
content: counter(step-counter);
position: absolute;
left: 20px;
top: 50%;
transform: translateY(-50%);
width: 60px;
height: 60px;
background: var(--gradient-warning);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 1.8rem;
font-weight: 900;
color: white;
}
.step h3 {
color: var(--accent-orange);
margin-bottom: 10px;
font-size: 1.5rem;
}
.feature-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 25px;
margin: 30px 0;
}
.feature-card {
background: var(--bg-secondary);
padding: 30px;
border-radius: 15px;
text-align: center;
transition: all 0.3s ease;
border: 2px solid transparent;
}
.feature-card:hover {
border-color: var(--accent-orange);
transform: translateY(-10px);
}
.feature-icon {
font-size: 3.5rem;
margin-bottom: 15px;
}
.feature-title {
font-weight: 600;
color: var(--accent-orange);
margin-bottom: 10px;
font-size: 1.3rem;
}
.demo-container {
background: var(--bg-secondary);
border-radius: 20px;
padding: 40px;
margin: 30px 0;
}
.deprecation-box {
background: var(--bg-card);
border-radius: 15px;
padding: 30px;
margin: 30px 0;
border: 2px solid var(--accent-orange);
}
.comparison-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
margin: 30px 0;
}
.comparison-item {
background: var(--bg-secondary);
padding: 25px;
border-radius: 15px;
border: 2px solid transparent;
}
.comparison-item.without {
border-color: var(--accent-red);
}
.comparison-item.with {
border-color: var(--accent-green);
}
.terminal {
background: #1e1e1e;
border-radius: 15px;
padding: 20px;
font-family: 'Fira Code', monospace;
min-height: 250px;
margin: 20px 0;
overflow-y: auto;
max-height: 500px;
}
.terminal-line {
margin: 10px 0;
}
.terminal-prompt {
color: var(--accent-green);
}
.terminal-success {
color: var(--accent-green);
font-weight: 600;
}
.demo-button {
background: var(--gradient-warning);
color: white;
border: none;
padding: 15px 40px;
border-radius: 50px;
font-size: 1.1rem;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
display: inline-flex;
align-items: center;
gap: 10px;
margin: 10px;
}
.demo-button:hover {
transform: scale(1.05);
box-shadow: 0 10px 30px rgba(245, 158, 11, 0.4);
}
.tabs {
display: flex;
gap: 10px;
margin-bottom: 20px;
flex-wrap: wrap;
}
.tab {
padding: 12px 24px;
background: var(--bg-secondary);
border: none;
border-radius: 10px;
color: var(--text-primary);
cursor: pointer;
transition: all 0.3s ease;
font-size: 1rem;
}
.tab:hover {
background: var(--bg-card);
}
.tab.active {
background: var(--gradient-warning);
color: white;
}
.tab-content {
display: none;
}
.tab-content.active {
display: block;
}
.accordion-header {
cursor: pointer;
display: flex;
justify-content: space-between;
align-items: center;
padding: 20px;
background: var(--bg-secondary);
border-radius: 12px;
margin: 15px 0;
transition: all 0.3s ease;
}
.accordion-header:hover {
background: var(--bg-card);
}
.accordion-icon {
transition: transform 0.3s ease;
font-size: 1.2rem;
}
.accordion-icon.active {
transform: rotate(180deg);
}
.accordion-content {
max-height: 0;
overflow: hidden;
transition: max-height 0.3s ease;
}
.accordion-content.active {
max-height: 2000px;
}
.accordion-body {
padding: 20px;
background: var(--bg-secondary);
border-radius: 12px;
margin-top: 5px;
}
.tip, .warning, .success, .info {
padding: 20px;
border-radius: 10px;
margin: 20px 0;
}
.tip {
background: rgba(59, 130, 246, 0.1);
border-left: 4px solid var(--accent-blue);
}
.tip::before { content: '💡 '; font-size: 1.5rem; }
.warning {
background: rgba(239, 68, 68, 0.1);
border-left: 4px solid var(--accent-red);
}
.warning::before { content: '⚠️ '; font-size: 1.5rem; }
.success {
background: rgba(16, 185, 129, 0.1);
border-left: 4px solid var(--accent-green);
}
.success::before { content: '✅ '; font-size: 1.5rem; }
.info {
background: rgba(236, 72, 153, 0.1);
border-left: 4px solid var(--accent-pink);
}
.info::before { content: '🔍 '; font-size: 1.5rem; }
.quiz-container {
background: var(--bg-card);
border-radius: 20px;
padding: 40px;
margin: 30px 0;
}
.quiz-question {
margin: 30px 0;
}
.quiz-question h3 {
color: var(--accent-purple);
margin-bottom: 20px;
font-size: 1.3rem;
}
.quiz-options {
display: flex;
flex-direction: column;
gap: 15px;
}
.quiz-option {
background: var(--bg-secondary);
padding: 20px;
border-radius: 12px;
cursor: pointer;
transition: all 0.3s ease;
border: 2px solid transparent;
}
.quiz-option:hover {
border-color: var(--accent-blue);
transform: translateX(10px);
}
.quiz-option.correct {
border-color: var(--accent-green);
background: rgba(16, 185, 129, 0.1);
}
.quiz-option.incorrect {
border-color: var(--accent-red);
background: rgba(239, 68, 68, 0.1);
}
.quiz-feedback {
margin-top: 15px;
padding: 15px;
border-radius: 10px;
display: none;
}
.quiz-feedback.show {
display: block;
}
.quiz-feedback.correct {
background: rgba(16, 185, 129, 0.1);
border-left: 4px solid var(--accent-green);
}
.quiz-feedback.incorrect {
background: rgba(239, 68, 68, 0.1);
border-left: 4px solid var(--accent-red);
}
.cheat-sheet {
background: var(--gradient-warning);
border-radius: 20px;
padding: 40px;
margin: 30px 0;
color: white;
}
.cheat-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 20px;
margin-top: 30px;
}
.cheat-item {
background: rgba(255, 255, 255, 0.15);
backdrop-filter: blur(10px);
padding: 20px;
border-radius: 15px;
border: 1px solid rgba(255, 255, 255, 0.2);
}
.cheat-item h4 {
color: white;
margin-bottom: 10px;
font-weight: 600;
}
.cheat-item code {
background: rgba(0, 0, 0, 0.3);
padding: 4px 8px;
border-radius: 5px;
font-size: 0.9rem;
color: white;
}
.highlight {
color: var(--accent-yellow);
font-weight: 600;
}
.footer {
text-align: center;
padding: 40px 20px;
background: var(--bg-secondary);
margin-top: 80px;
border-radius: 20px;
}
.footer p {
color: var(--text-secondary);
margin: 10px 0;
}
.badge {
display: inline-block;
padding: 6px 12px;
background: var(--gradient-warning);
border-radius: 20px;
font-size: 0.85rem;
font-weight: 600;
margin: 5px;
}
.confetti {
position: fixed;
width: 10px;
height: 10px;
background: var(--accent-orange);
animation: confetti-fall 3s linear forwards;
z-index: 9999;
}
@keyframes confetti-fall {
to {
transform: translateY(100vh) rotate(360deg);
opacity: 0;
}
}
@media (max-width: 768px) {
.hero h1 { font-size: 2rem; }
.command-display { font-size: 0.85rem; padding: 15px 20px; }
.section-title { font-size: 1.8rem; }
.card { padding: 25px; }
.step { padding-left: 80px; }
.step::before { width: 50px; height: 50px; font-size: 1.5rem; }
.comparison-grid { grid-template-columns: 1fr; }
}
</style>
</head>
<body>
<div class="progress-container">
<div class="progress-bar" id="progressBar"></div>
</div>
<div class="hero">
<div class="hero-content">
<div class="warning-icon">⚠️</div>
<h1>Trace Deprecations!</h1>
<div class="command-display">node --trace-deprecation app.js</div>
<p>Find where deprecated code is being used! 🔍</p>
</div>
</div>
<div class="container">
<!-- What Is It -->
<section class="section">
<h2 class="section-title">🤔 What Is Trace Deprecation?</h2>
<div class="card">
<p style="font-size: 1.2rem; margin-bottom: 20px;">
This command runs your Node.js app with <span class="highlight">detailed deprecation warnings</span>, showing you <strong>exactly where</strong> in your code you're using outdated/deprecated APIs with full stack traces! ⚠️
</p>
<p style="margin-bottom: 20px;">
Think of it like having a building inspector! 🏗️ When you use old, outdated methods that Node.js plans to remove, normally you just get a simple warning. With <code>--trace-deprecation</code>, you get a full report showing EXACTLY which file and line is using the old code - like a GPS pointing to the problem!
</p>
<div class="info">
<strong>Breaking It Down:</strong>
<ul style="margin-left: 30px; margin-top: 10px; line-height: 2;">
<li><code class="code-node">node</code> - Node.js runtime</li>
<li><code class="code-flag">--trace-deprecation</code> - Show stack traces for deprecations</li>
<li><code>app.js</code> - Your application file</li>
<li>Shows WHERE deprecated code is called</li>
<li>Helps you fix code before it breaks</li>
</ul>
</div>
<div style="margin-top: 30px;">
<h3 style="color: var(--accent-pink); margin-bottom: 15px;">What's a Deprecation? 🔍</h3>
<p>A deprecation is when Node.js marks a feature as "outdated" and plans to remove it in future versions. It's like a "this will stop working soon" warning. The <code>--trace-deprecation</code> flag helps you find and fix these before they become breaking errors!</p>
</div>
</div>
</section>
<!-- Warning Comparison -->
<section class="section">
<h2 class="section-title">📊 Before & After</h2>
<div class="card">
<h3 style="margin-bottom: 20px; text-align: center;">See The Difference! 🎯</h3>
<div class="comparison-grid">
<div class="comparison-item without">
<h4 style="color: var(--accent-red); margin-bottom: 15px;">❌ Without --trace-deprecation</h4>
<div class="code-block" style="margin-top: 15px;">
<pre><code><span class="code-warning">(node:12345) DeprecationWarning: Buffer() is deprecated</span></code></pre>
</div>
<p style="margin-top: 10px; font-size: 0.9rem; color: var(--text-secondary);">😕 Where is this being used? No idea!</p>
</div>
<div class="comparison-item with">
<h4 style="color: var(--accent-green); margin-bottom: 15px;">✅ With --trace-deprecation</h4>
<div class="code-block" style="margin-top: 15px;">
<pre><code><span class="code-warning">(node:12345) DeprecationWarning: Buffer() is deprecated</span>
at createBuffer (src/utils.js:42:15)
at processData (src/app.js:58:5)
at main (src/app.js:120:3)</code></pre>
</div>
<p style="margin-top: 10px; font-size: 0.9rem; color: var(--text-secondary);">😊 Line 42 of utils.js! Now I can fix it!</p>
</div>
</div>
</div>
</section>
<!-- Why Use It -->
<section class="section">
<h2 class="section-title">✨ Why Use --trace-deprecation?</h2>
<div class="card">
<div class="feature-grid">
<div class="feature-card">
<div class="feature-icon">🔍</div>
<div class="feature-title">Find Issues</div>
<p style="color: var(--text-secondary);">Locate deprecated code!</p>
</div>
<div class="feature-card">
<div class="feature-icon">🛡️</div>
<div class="feature-title">Future-Proof</div>
<p style="color: var(--text-secondary);">Fix before it breaks!</p>
</div>
<div class="feature-card">
<div class="feature-icon">📍</div>
<div class="feature-title">Exact Location</div>
<p style="color: var(--text-secondary);">See file and line number!</p>
</div>
<div class="feature-card">
<div class="feature-icon">⚡</div>
<div class="feature-title">Faster Fixes</div>
<p style="color: var(--text-secondary);">No hunting for bugs!</p>
</div>
<div class="feature-card">
<div class="feature-icon">📚</div>
<div class="feature-title">Learn Better APIs</div>
<p style="color: var(--text-secondary);">Discover modern alternatives!</p>
</div>
<div class="feature-card">
<div class="feature-icon">🎯</div>
<div class="feature-title">Clean Code</div>
<p style="color: var(--text-secondary);">Keep code up-to-date!</p>
</div>
</div>
</div>
</section>
<!-- How It Works -->
<section class="section">
<h2 class="section-title">⚙️ How Does It Work?</h2>
<div class="card">
<div class="steps">
<div class="step">
<h3>Step 1: Node Starts</h3>
<p>Run with --trace-deprecation flag.</p>
</div>
<div class="step">
<h3>Step 2: Code Executes</h3>
<p>Your app runs normally.</p>
</div>
<div class="step">
<h3>Step 3: Deprecated API Called</h3>
<p>Your code uses an outdated method.</p>
</div>
<div class="step">
<h3>Step 4: Warning Triggered</h3>
<p>Node detects the deprecated usage.</p>
</div>
<div class="step">
<h3>Step 5: Stack Trace Generated</h3>
<p>Node captures the full call stack.</p>
</div>
<div class="step">
<h3>Step 6: Detailed Output</h3>
<p>You see exactly where the problem is! 🎉</p>
</div>
</div>
</div>
</section>
<!-- Live Demo -->
<section class="section">
<h2 class="section-title">🎮 Interactive Demo</h2>
<div class="demo-container">
<div style="margin-bottom: 30px; text-align: center;">
<h4 style="margin-bottom: 15px;">See Deprecation Warnings! ⚠️</h4>
<button class="demo-button" onclick="simulateWithout()">
<span>❌</span>
<span>Without Flag</span>
</button>
<button class="demo-button" onclick="simulateWith()">
<span>✅</span>
<span>With --trace-deprecation</span>
</button>
<button class="demo-button" onclick="simulateComparison()">
<span>⚖️</span>
<span>Side-by-Side</span>
</button>
</div>
<div class="terminal" id="terminal">
<div class="terminal-line">
<span class="terminal-prompt">$</span>
<span style="color: var(--text-secondary);"> Ready to run Node.js...</span>
</div>
</div>
</div>
</section>
<!-- Code Breakdown -->
<section class="section">
<h2 class="section-title">💻 Usage Examples</h2>
<div class="card">
<div class="tabs">
<button class="tab active" onclick="switchTab('basic')">Basic Usage</button>
<button class="tab" onclick="switchTab('examples')">Common Deprecations</button>
<button class="tab" onclick="switchTab('package')">package.json</button>
<button class="tab" onclick="switchTab('related')">Related Flags</button>
</div>
<div id="basic" class="tab-content active">
<h3 style="color: var(--accent-pink); margin-bottom: 15px;">Basic Usage</h3>
<div class="code-block">
<div class="code-header">
<div class="terminal-dots">
<div class="terminal-dot dot-red"></div>
<div class="terminal-dot dot-yellow"></div>
<div class="terminal-dot dot-green"></div>
</div>
<button class="copy-btn" onclick="copyCode('basic-code')">📋 Copy</button>
</div>
<pre><code id="basic-code"><span class="code-comment"># Run with deprecation tracing</span>
node --trace-deprecation app.js
<span class="code-comment"># Output shows full stack trace:</span>
<span class="code-comment"># (node:12345) DeprecationWarning: Buffer() is deprecated</span>
<span class="code-comment"># at createBuffer (src/utils.js:42:15)</span>
<span class="code-comment"># at processData (src/app.js:58:5)</span>
<span class="code-comment"># Combine with other flags</span>
node --trace-deprecation --inspect app.js</code></pre>
</div>
<div class="success" style="margin-top: 15px;">
<strong>Result:</strong> You see exactly where deprecated code is used!
</div>
</div>
<div id="examples" class="tab-content">
<h3 style="color: var(--accent-pink); margin-bottom: 15px;">Common Deprecations</h3>
<div class="code-block">
<div class="code-header">
<div class="terminal-dots">
<div class="terminal-dot dot-red"></div>
<div class="terminal-dot dot-yellow"></div>
<div class="terminal-dot dot-green"></div>
</div>
<button class="copy-btn" onclick="copyCode('examples-code')">📋 Copy</button>
</div>
<pre><code id="examples-code"><span class="code-comment">// ❌ DEPRECATED: Buffer constructor</span>
<span class="code-keyword">const</span> buf = <span class="code-keyword">new</span> Buffer(<span class="code-string">'hello'</span>);
<span class="code-comment">// ✅ MODERN: Buffer.from()</span>
<span class="code-keyword">const</span> buf = Buffer.from(<span class="code-string">'hello'</span>);
<span class="code-comment">// ❌ DEPRECATED: url.parse()</span>
<span class="code-keyword">const</span> url = <span class="code-keyword">require</span>(<span class="code-string">'url'</span>);
<span class="code-keyword">const</span> parsed = url.parse(<span class="code-string">'http://example.com'</span>);
<span class="code-comment">// ✅ MODERN: new URL()</span>
<span class="code-keyword">const</span> parsed = <span class="code-keyword">new</span> URL(<span class="code-string">'http://example.com'</span>);
<span class="code-comment">// ❌ DEPRECATED: crypto.createCipher()</span>
<span class="code-keyword">const</span> cipher = crypto.createCipher(<span class="code-string">'aes192'</span>, password);
<span class="code-comment">// ✅ MODERN: crypto.createCipheriv()</span>
<span class="code-keyword">const</span> cipher = crypto.createCipheriv(<span class="code-string">'aes-192-cbc'</span>, key, iv);</code></pre>
</div>
<div class="tip" style="margin-top: 15px;">
<strong>Pro Tip:</strong> Always use modern alternatives to avoid future breaking changes!
</div>
</div>
<div id="package" class="tab-content">
<h3 style="color: var(--accent-pink); margin-bottom: 15px;">Add to package.json</h3>
<div class="code-block">
<div class="code-header">
<div class="terminal-dots">
<div class="terminal-dot dot-red"></div>
<div class="terminal-dot dot-yellow"></div>
<div class="terminal-dot dot-green"></div>
</div>
<button class="copy-btn" onclick="copyCode('package-code')">📋 Copy</button>
</div>
<pre><code id="package-code"><span class="code-comment">// package.json</span>
{
<span class="code-string">"name"</span>: <span class="code-string">"my-app"</span>,
<span class="code-string">"scripts"</span>: {
<span class="code-string">"start"</span>: <span class="code-string">"node app.js"</span>,
<span class="code-string">"dev"</span>: <span class="code-string">"node --trace-deprecation app.js"</span>,
<span class="code-string">"test"</span>: <span class="code-string">"node --trace-deprecation test.js"</span>,
<span class="code-string">"debug"</span>: <span class="code-string">"node --trace-deprecation --inspect app.js"</span>
}
}
<span class="code-comment"># Run in dev mode to catch deprecations:</span>
npm run dev</code></pre>
</div>
<div class="success" style="margin-top: 15px;">
<strong>Best Practice:</strong> Use --trace-deprecation in development and testing!
</div>
</div>
<div id="related" class="tab-content">
<h3 style="color: var(--accent-pink); margin-bottom: 15px;">Related Flags</h3>
<div class="code-block">
<div class="code-header">
<div class="terminal-dots">
<div class="terminal-dot dot-red"></div>
<div class="terminal-dot dot-yellow"></div>
<div class="terminal-dot dot-green"></div>
</div>
<button class="copy-btn" onclick="copyCode('related-code')">📋 Copy</button>
</div>
<pre><code id="related-code"><span class="code-comment"># --trace-deprecation: Show stack traces for deprecations</span>
node --trace-deprecation app.js
<span class="code-comment"># --throw-deprecation: Throw errors instead of warnings</span>
node --throw-deprecation app.js
<span class="code-comment"># (Useful for CI/CD to fail on deprecations)</span>
<span class="code-comment"># --no-deprecation: Hide all deprecation warnings</span>
node --no-deprecation app.js
<span class="code-comment"># (NOT recommended - you should fix deprecations!)</span>
<span class="code-comment"># --trace-warnings: Show stack traces for ALL warnings</span>
node --trace-warnings app.js
<span class="code-comment"># Combine flags:</span>
node --trace-deprecation --trace-warnings app.js</code></pre>
</div>
</div>
</div>
</section>
<!-- Common Mistakes -->
<section class="section">
<h2 class="section-title">❌ Common Mistakes</h2>
<div class="card">
<div class="accordion">
<div class="accordion-item">
<div class="accordion-header" onclick="toggleAccordion(this)">
<span><strong>1. Ignoring Deprecation Warnings</strong></span>
<span class="accordion-icon">▼</span>
</div>
<div class="accordion-content">
<div class="accordion-body">
<div class="warning">
<strong>Problem:</strong> Seeing warnings but not fixing them
</div>
<div class="success" style="margin-top: 15px;">
<strong>Solution:</strong> Use --trace-deprecation to find and fix ALL deprecations before they break!
</div>
</div>
</div>
</div>
<div class="accordion-item">
<div class="accordion-header" onclick="toggleAccordion(this)">
<span><strong>2. Using --no-deprecation in Production</strong></span>
<span class="accordion-icon">▼</span>
</div>
<div class="accordion-content">
<div class="accordion-body">
<div class="warning">
<strong>Problem:</strong> Hiding warnings instead of fixing them
</div>
<div class="success" style="margin-top: 15px;">
<strong>Solution:</strong> Fix the deprecated code! Don't hide the warnings!
</div>
</div>
</div>
</div>
<div class="accordion-item">
<div class="accordion-header" onclick="toggleAccordion(this)">
<span><strong>3. Not Testing with Flag</strong></span>
<span class="accordion-icon">▼</span>
</div>
<div class="accordion-content">
<div class="accordion-body">
<div class="warning">
<strong>Problem:</strong> Only discovering deprecations in production
</div>
<div class="success" style="margin-top: 15px;">
<strong>Solution:</strong> Add --trace-deprecation to your dev and test scripts!
</div>
</div>
</div>
</div>
<div class="accordion-item">
<div class="accordion-header" onclick="toggleAccordion(this)">
<span><strong>4. Deprecations in Dependencies</strong></span>
<span class="accordion-icon">▼</span>
</div>
<div class="accordion-content">
<div class="accordion-body">
<div class="warning">
<strong>Problem:</strong> Seeing deprecations from node_modules packages
</div>
<div class="success" style="margin-top: 15px;">
<strong>Solution:</strong> Update dependencies or report issues to package maintainers!
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Pro Tips -->
<section class="section">
<h2 class="section-title">🚀 Pro Tips</h2>
<div class="card">
<div class="tip">
<strong>Use in development</strong> - Add --trace-deprecation to dev scripts to catch issues early!
</div>
<div class="tip">
<strong>CI/CD integration</strong> - Use --throw-deprecation in tests to fail builds on deprecations!
</div>
<div class="tip">
<strong>Regular audits</strong> - Run with flag periodically to check for new deprecations!
</div>
<div class="tip">
<strong>Update dependencies</strong> - Many deprecations come from outdated packages!
</div>
<div class="tip">
<strong>Read Node.js docs</strong> - Check deprecation guides for modern alternatives!
</div>
<div class="tip">
<strong>Combine flags</strong> - Use with --trace-warnings for comprehensive debugging!
</div>
<div class="tip">
<strong>Fix immediately</strong> - Don't let deprecations pile up - fix them as they appear!
</div>
</div>
</section>
<!-- Quiz -->
<section class="section">
<h2 class="section-title">🎯 Knowledge Check Quiz</h2>
<div class="quiz-container">
<p style="margin-bottom: 30px; font-size: 1.1rem;">Test your understanding! 🧠</p>
<div class="quiz-question">
<h3>Question 1: What does --trace-deprecation show?</h3>
<div class="quiz-options">
<div class="quiz-option" onclick="checkAnswer(this, false, 1)">A) Only the deprecation message</div>
<div class="quiz-option" onclick="checkAnswer(this, true, 1)">B) Deprecation message with full stack trace</div>
<div class="quiz-option" onclick="checkAnswer(this, false, 1)">C) Nothing - it hides warnings</div>
</div>
<div class="quiz-feedback" id="feedback1"></div>
</div>
<div class="quiz-question">
<h3>Question 2: What's a deprecation?</h3>
<div class="quiz-options">
<div class="quiz-option" onclick="checkAnswer(this, false, 2)">A) A syntax error</div>
<div class="quiz-option" onclick="checkAnswer(this, true, 2)">B) An outdated feature marked for removal</div>
<div class="quiz-option" onclick="checkAnswer(this, false, 2)">C) A performance issue</div>
</div>
<div class="quiz-feedback" id="feedback2"></div>
</div>
<div class="quiz-question">
<h3>Question 3: Should you use --no-deprecation?</h3>
<div class="quiz-options">
<div class="quiz-option" onclick="checkAnswer(this, false, 3)">A) Yes, always hide warnings</div>
<div class="quiz-option" onclick="checkAnswer(this, true, 3)">B) No, fix deprecations instead</div>
<div class="quiz-option" onclick="checkAnswer(this, false, 3)">C) Only in production</div>
</div>
<div class="quiz-feedback" id="feedback3"></div>
</div>
<div id="quizScore" style="margin-top: 30px; padding: 20px; background: var(--bg-secondary); border-radius: 12px; display: none;">
<h3 style="color: var(--accent-green); font-size: 1.5rem;">🎉 Quiz Complete!</h3>
<p id="scoreText" style="font-size: 1.2rem; margin-top: 10px;"></p>
</div>
</div>
</section>
<!-- Summary Card -->
<section class="section">
<h2 class="section-title">📚 Quick Reference</h2>
<div class="cheat-sheet">
<h3 style="margin-bottom: 20px; font-size: 2rem;">Trace Deprecation Cheat Sheet! 🔖</h3>
<div class="cheat-grid">
<div class="cheat-item">
<h4>⚠️ Command</h4>
<p><code>node --trace-deprecation app.js</code></p>
<p style="font-size: 0.85rem; margin-top: 5px;">Show stack traces</p>
</div>
<div class="cheat-item">
<h4>📍 Purpose</h4>
<p>Find deprecated code</p>
<p style="font-size: 0.85rem; margin-top: 5px;">See exact location</p>
</div>
<div class="cheat-item">
<h4>🔍 Output</h4>
<p>Full stack trace</p>
<p style="font-size: 0.85rem; margin-top: 5px;">File + line number</p>
</div>
<div class="cheat-item">
<h4>💥 --throw-deprecation</h4>
<p>Throw errors</p>
<p style="font-size: 0.85rem; margin-top: 5px;">Fail on deprecation</p>
</div>
<div class="cheat-item">
<h4>🚫 --no-deprecation</h4>
<p>Hide warnings</p>
<p style="font-size: 0.85rem; margin-top: 5px;">NOT recommended!</p>
</div>
<div class="cheat-item">
<h4>📦 package.json</h4>
<p><code>"dev": "node --trace-deprecation app.js"</code></p>
<p style="font-size: 0.85rem; margin-top: 5px;">Add to scripts</p>
</div>
<div class="cheat-item">
<h4>✅ Best Practice</h4>
<p>Fix immediately</p>
<p style="font-size: 0.85rem; margin-top: 5px;">Don't ignore!</p>
</div>
<div class="cheat-item">
<h4>🎯 Use For</h4>
<p>Development & testing</p>
<p style="font-size: 0.85rem; margin-top: 5px;">Catch early</p>
</div>
</div>
</div>
</section>
<!-- Footer -->
<div class="footer">
<h2 style="font-size: 2rem; margin-bottom: 20px; color: var(--accent-pink);">🎉 Congratulations!</h2>
<p style="font-size: 1.2rem; margin-bottom: 20px;">You now understand <strong>--trace-deprecation</strong>! 🚀</p>
<div style="margin: 30px 0;">
<span class="badge">⚠️ Warning Master</span>
<span class="badge">🔍 Debug Pro</span>
<span class="badge">🚀 Node Expert</span>
</div>
<p style="color: var(--text-secondary); margin-top: 30px;">Generated by <strong>AI Prompt Dictionary</strong> 🤖</p>
<p style="color: var(--text-secondary); font-size: 0.9rem;">Made with ❤️ for developers learning Node.js</p>
</div>
</div>
<script>
// Progress bar
window.addEventListener('scroll', () => {
const winScroll = document.body.scrollTop || document.documentElement.scrollTop;
const height = document.documentElement.scrollHeight - document.documentElement.clientHeight;
const scrolled = (winScroll / height) * 100;
document.getElementById('progressBar').style.width = scrolled + '%';
});
// Copy to clipboard
function copyCode(codeId) {
const code = document.getElementById(codeId).innerText;
navigator.clipboard.writeText(code).then(() => {
event.target.textContent = '✅ Copied!';
event.target.classList.add('copied');
setTimeout(() => {
event.target.textContent = '📋 Copy';
event.target.classList.remove('copied');
}, 2000);
});
}
// Tab switching
function switchTab(tabName) {
document.querySelectorAll('.tab-content').forEach(c => c.classList.remove('active'));
document.querySelectorAll('.tab').forEach(t => t.classList.remove('active'));
document.getElementById(tabName).classList.add('active');
event.target.classList.add('active');
}
// Accordion toggle
function toggleAccordion(header) {
const content = header.nextElementSibling;
const icon = header.querySelector('.accordion-icon');
content.classList.toggle('active');
icon.classList.toggle('active');
}
// Simulate without flag
function simulateWithout() {
const terminal = document.getElementById('terminal');
terminal.innerHTML = '<div class="terminal-line"><span class="terminal-prompt">$</span> node app.js</div>';
setTimeout(() => {
terminal.innerHTML += '<div style="color: var(--accent-cyan); margin-top: 10px;">🚀 Starting application...</div>';
}, 500);
setTimeout(() => {
terminal.innerHTML += '<div style="color: var(--accent-yellow); margin-top: 15px; font-weight: 600;">(node:12345) DeprecationWarning: Buffer() is deprecated due to security and usability issues.</div>';
terminal.innerHTML += '<div style="color: var(--accent-red); margin-top: 15px;">😕 Where is this being used? No stack trace!</div>';
terminal.innerHTML += '<div style="color: var(--text-secondary); margin-top: 5px;">I have to search through all my code manually...</div>';
}, 1500);
}
// Simulate with flag
function simulateWith() {
const terminal = document.getElementById('terminal');
terminal.innerHTML = '<div class="terminal-line"><span class="terminal-prompt">$</span> node --trace-deprecation app.js</div>';
setTimeout(() => {
terminal.innerHTML += '<div style="color: var(--accent-cyan); margin-top: 10px;">🚀 Starting application with deprecation tracing...</div>';
}, 500);
setTimeout(() => {
terminal.innerHTML += '<div style="color: var(--accent-yellow); margin-top: 15px; font-weight: 600;">(node:12345) DeprecationWarning: Buffer() is deprecated due to security and usability issues.</div>';
terminal.innerHTML += '<div style="color: var(--accent-green); margin-left: 20px; margin-top: 5px; font-weight: 600;">at createBuffer (src/utils.js:42:15)</div>';
terminal.innerHTML += '<div style="color: var(--accent-green); margin-left: 20px; font-weight: 600;">at processData (src/app.js:58:5)</div>';
terminal.innerHTML += '<div style="color: var(--accent-green); margin-left: 20px; font-weight: 600;">at main (src/app.js:120:3)</div>';
terminal.innerHTML += '<div style="color: var(--accent-green); margin-top: 15px;">😊 Perfect! Line 42 of utils.js - I can fix it now!</div>';
createConfetti();
}, 1500);
}
// Simulate comparison
function simulateComparison() {
const terminal = document.getElementById('terminal');
terminal.innerHTML = '<div style="color: var(--accent-purple); font-weight: 600; font-size: 1.1rem;">📊 Deprecation Warning Comparison</div>';
terminal.innerHTML += '<div style="margin-top: 20px; color: var(--accent-red);">❌ WITHOUT --trace-deprecation:</div>';
terminal.innerHTML += '<div style="margin-left: 20px; color: var(--accent-yellow); font-size: 0.9rem;">(node:12345) DeprecationWarning: Buffer() is deprecated</div>';
terminal.innerHTML += '<div style="margin-left: 20px; color: var(--text-secondary); font-size: 0.85rem;">😕 No location info - have to search manually!</div>';
terminal.innerHTML += '<div style="margin-top: 20px; color: var(--accent-green);">✅ WITH --trace-deprecation:</div>';
terminal.innerHTML += '<div style="margin-left: 20px; color: var(--accent-yellow); font-size: 0.9rem;">(node:12345) DeprecationWarning: Buffer() is deprecated</div>';
terminal.innerHTML += '<div style="margin-left: 40px; color: var(--accent-green); font-size: 0.85rem;">at createBuffer (src/utils.js:42:15)</div>';
terminal.innerHTML += '<div style="margin-left: 20px; color: var(--text-secondary); font-size: 0.85rem; margin-top: 5px;">😊 Exact location - easy to fix!</div>';
terminal.innerHTML += '<div style="margin-top: 20px; color: var(--accent-cyan); font-weight: 600;">💡 Stack traces save debugging time!</div>';
createConfetti();
}
// Quiz system
let quizScore = 0;
let questionsAnswered = 0;
function checkAnswer(element, isCorrect, questionNum) {
const options = element.parentElement.querySelectorAll('.quiz-option');
options.forEach(opt => opt.style.pointerEvents = 'none');
const feedback = document.getElementById('feedback' + questionNum);
if (isCorrect) {
element.classList.add('correct');
feedback.className = 'quiz-feedback correct show';
feedback.innerHTML = '<strong>🎉 Correct!</strong> Great job!';
quizScore++;
createConfetti();
} else {
element.classList.add('incorrect');
feedback.className = 'quiz-feedback incorrect show';
feedback.innerHTML = '<strong>❌ Not quite!</strong> Review the material and try again!';
}
questionsAnswered++;
if (questionsAnswered === 3) {
setTimeout(() => {
document.getElementById('quizScore').style.display = 'block';
document.getElementById('scoreText').textContent = `You scored ${quizScore}/3! ${quizScore === 3 ? '🏆 Perfect!' : quizScore === 2 ? '👍 Good job!' : '💪 Keep learning!'}`;
}, 1000);
}
}
// Confetti animation
function createConfetti() {
const colors = ['#f59e0b', '#fb923c', '#ef4444', '#ec4899', '#10b981'];
for (let i = 0; i < 50; i++) {
const confetti = document.createElement('div');
confetti.className = 'confetti';
confetti.style.left = Math.random() * window.innerWidth + 'px';
confetti.style.background = colors[Math.floor(Math.random() * colors.length)];
confetti.style.animationDuration = (2 + Math.random() * 2) + 's';
document.body.appendChild(confetti);
setTimeout(() => confetti.remove(), 4000);
}
}
</script>
</body>
</html>
Live Preview