PageSourceSearch

https://discordjs-guide.netlify.app/preparations/

html discordjs-guide.netlify.app collected 2026-10-03 10:39:25 UTC 37,339 bytes, 57 lines download raw bytes

1<!DOCTYPE html>
2<html lang="en-US">
3<head>
4	<style>
5		:root {
6			--c-bg: #fff;
7		}
8
9		html.dark {
10			--c-bg: #1d1d1d;
11		}
12
13		html, body {
14			background-color: var(--c-bg);
15		}
16	</style>
17	
17<script>
18		(() => {
19			const { classList } = document.documentElement;
20			const userMode = localStorage.getItem('guide-color-scheme');
21			const systemDarkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
22
23			if (userMode === 'dark' || (userMode !== 'light' && systemDarkMode)) {
24				classList.toggle('dark', true);
25			}
26
27			const themes = ['blurple'];
28			let colorTheme = localStorage.getItem('guide-color-theme');
29
30			if (colorTheme !== 'default' && !themes.includes(colorTheme)) {
31				colorTheme = 'default';
32			}
33
34			if (colorTheme !== 'default') classList.add(`guide-theme-${colorTheme}`);
35		})();
36	</script>
36
37<meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><link rel="icon" href="/favicon.png"><meta name="theme-color" content="#3eaf7c"><meta name="twitter:card" content="summary"><meta property="og:title" content="discord.js Guide"><meta property="og:description" content="Imagine a guide... that explores the many possibilities for your discord.js bot."><meta property="og:type" content="website"><meta property="og:url" content="https://discordjs.guide/"><meta property="og:locale" content="en_US"><meta property="og:image" content="/meta-image.png"><title>Installing Node.js and discord.js | discord.js Guide</title><meta name="description" content="Imagine a guide... that explores the many possibilities for your discord.js bot.">
38<link rel="modulepreload" href="/assets/app.1a0d0096.js"><link rel="modulepreload" href="/assets/index.html.bb6e4042.js"><link rel="modulepreload" href="/assets/index.html.3a63ff62.js">
39<link rel="stylesheet" href="/assets/style.83d7afb2.css">
40</head>
41<body>
42	<div id="app"><!--[--><div class="theme-container"><header class="navbar"><div class="navbar-wrapper"><div class="navbar-links-wrapper"><div class="navbar-links-container"><span class="navbar-links-home"><a href="/" class="">discord.js Guide</a></span><!--[--><!--]--><nav class="navbar-links can-hide"><!--[--><div class="navbar-links-item"><a href="/voice/" class="nav-link" aria-label="Voice"><!--[--><!--]--> Voice <!--[--><!--]--></a></div><div class="navbar-links-item"><a class="nav-link external" href="https://discord.js.org/docs/packages/discord.js/stable" rel="noopener noreferrer" target="_blank" aria-label="Documentation"><!--[--><!--]--> Documentation <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></div><div class="navbar-links-item"><a class="nav-link external" href="https://github.com/discordjs/guide" rel="noopener noreferrer" target="_blank" aria-label="GitHub"><!--[--><!--]--> GitHub <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></div><!--]--></nav><!--[--><!--]--></div><div class="navbar-links-container"><button class="toggle-dark-button"><svg class="icon light-icon" focusable="false" viewBox="0 0 32 32"><path d="M16 12.005a4 4 0 1 1-4 4a4.005 4.005 0 0 1 4-4m0-2a6 6 0 1 0 6 6a6 6 0 0 0-6-6z" fill="currentColor"></path><path d="M5.394 6.813l1.414-1.415l3.506 3.506L8.9 10.318z" fill="currentColor"></path><path d="M2 15.005h5v2H2z" fill="currentColor"></path><path d="M5.394 25.197L8.9 21.691l1.414 1.415l-3.506 3.505z" fill="currentColor"></path><path d="M15 25.005h2v5h-2z" fill="currentColor"></path><path d="M21.687 23.106l1.414-1.415l3.506 3.506l-1.414 1.414z" fill="currentColor"></path><path d="M25 15.005h5v2h-5z" fill="currentColor"></path><path d="M21.687 8.904l3.506-3.506l1.414 1.415l-3.506 3.505z" fill="currentColor"></path><path d="M15 2.005h2v5h-2z" fill="currentColor"></path></svg><svg class="icon dark-icon" focusable="false" viewBox="0 0 32 32"><path d="M13.502 5.414a15.075 15.075 0 0 0 11.594 18.194a11.113 11.113 0 0 1-7.975 3.39c-.138 0-.278.005-.418 0a11.094 11.094 0 0 1-3.2-21.584M14.98 3a1.002 1.002 0 0 0-.175.016a13.096 13.096 0 0 0 1.825 25.981c.164.006.328 0 .49 0a13.072 13.072 0 0 0 10.703-5.555a1.01 1.01 0 0 0-.783-1.565A13.08 13.08 0 0 1 15.89 4.38A1.015 1.015 0 0 0 14.98 3z" fill="currentColor"></path></svg></button><div id="docsearch-container" class="navbar-search"></div><div class="toggle-sidebar-button"><svg viewbox="0 0 448 512" class="icon sidebar-menu-icon">
42<path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg><svg viewbox="0 0 24 24" class="icon sidebar-close-icon"><path d="M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12L19 6.41z" fill="currentColor"></path></svg></div></div></div></div></header><div class="content-wrapper"><div class="notifications-wrapper"><div class="notifications"><!--[--><!----><!--]--></div></div><div class="sidebar-mask"></div><div class="sidebar-wrapper"><aside class="sidebar"><nav class="navbar-links"><!--[--><div class="navbar-links-item"><a href="/voice/" class="nav-link" aria-label="Voice"><!--[--><!--]--> Voice <!--[--><!--]--></a></div><div class="navbar-links-item"><a class="nav-link external" href="https://discord.js.org/docs/packages/discord.js/stable" rel="noopener noreferrer" target="_blank" aria-label="Documentation"><!--[--><!--]--> Documentation <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></div><div class="navbar-links-item"><a class="nav-link external" href="https://github.com/discordjs/guide" rel="noopener noreferrer" target="_blank" aria-label="GitHub"><!--[--><!--]--> GitHub <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></div><!--]--></nav><!--[--><!--]--><ul class="sidebar-links"><div class="sidebar-group sidebar-group-collapsed"><button class="sidebar-heading sidebar-item"> Settings <svg viewbox="0 0 24 24" class="menu-icon"><path d="M7.41 8.58L12 13.17l4.59-4.59L18 10l-6 6l-6-6l1.41-1.42z" fill="currentColor"></path></svg></button><ul style="display:none;"><li><div class="sidebar-item"><div class="theme-options"><ul class="color-theme-options"><span>Theme</span><li><button class="default-theme" title="Green theme"></button></li><li><button class="blurple-theme" title="Blurple theme"></button></li></ul></div></div></li></ul></div><!--[--><!--[--><p class="sidebar-heading sidebar-item">Home</p><ul class=""><li><!--[--><a href="/" class="nav-link sidebar-item" aria-label="Introduction"><!--[--><!--]--> Introduction <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Requesting more content' class='nav-link sidebar-item' href='/requesting-more-content'><!--[--><!--]--> Requesting more content <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='What&#39;s new' class='nav-link sidebar-item' href='/whats-new'><!--[--><!--]--> What&#39;s new <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--><!--[--><p class="sidebar-heading sidebar-item active">Installations &amp; Preparations</p><ul class=""><li><!--[--><a aria-current="page" href="/preparations/" class="router-link-active router-link-exact-active nav-link router-link-active sidebar-item active" aria-label="Installing Node.js and discord.js"><!--[--><!--]--> Installing Node.js and discord.js <!--[--><!--]--></a><ul class="sidebar-sub-items"><li><!--[--><a aria-current="page" href="/preparations/#installing-node-js" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Installing Node.js"><!--[--><!--]--> Installing Node.js <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/preparations/#preparing-the-essentials" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Preparing the essentials"><!--[--><!--]--> Preparing the essentials <!--[--><!--]--></a><ul class="sidebar-sub-items"><li><!--[--><a aria-current="page" href="/preparations/#opening-the-terminal" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Opening the terminal"><!--[--><!--]--> Opening the terminal <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/preparations/#initiating-a-project-folder" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Initiating a project folder"><!--[--><!--]--> Initiating a project folder <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--></li><li><!--[--><a aria-current="page" href="/preparations/#installing-discord-js" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Installing discord.js"><!--[--><!--]--> Installing discord.js <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/preparations/#installing-a-linter" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Installing a linter"><!--[--><!--]--> Installing a linter <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--></li><li><!--[--><a aria-label='Setting up a linter' class='nav-link sidebar-item' href='/preparations/setting-up-a-linter'><!--[--><!--]--> Setting up a linter <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Setting up a bot application' class='nav-link sidebar-item' href='/preparations/setting-up-a-bot-application'><!--[--><!--]--> Setting up a bot application <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Adding your bot to servers' class='nav-link sidebar-item' href='/preparations/adding-your-bot-to-servers'><!--[--><!--]--> Adding your bot to servers <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--><!--[--><p class="sidebar-heading sidebar-item">Creating Your Bot</p><ul class=""><li><!--[--><a href="/creating-your-bot/" class="nav-link sidebar-item" aria-label="Configuration files"><!--[--><!--]--> Configuration files <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Creating the main file' class='nav-link sidebar-item' href='/creating-your-bot/main-file'><!--[--><!--]--> Creating the main file <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Creating slash commands' class='nav-link sidebar-item' href='/creating-your-bot/slash-commands'><!--[--><!--]--> Creating slash commands <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Command handling' class='nav-link sidebar-item' href='/creating-your-bot/command-handling'><!--[--><!--]--> Command handling <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Registering slash commands' class='nav-link sidebar-item' href='/creating-your-bot/command-deployment'><!--[--><!--]--> Registering slash commands <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Event handling' class='nav-link sidebar-item' href='/creating-your-bot/event-handling'><!--[--><!--]--> Event handling <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--><!--[--><p class="sidebar-heading sidebar-item">Additional Features</p><ul class=""><li><!--[--><a aria-label='Cooldowns' class='nav-link sidebar-item' href='/additional-features/cooldowns'><!--[--><!--]--> Cooldowns <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Reloading Commands' class='nav-link sidebar-item' href='/additional-features/reloading-commands'><!--[--><!--]--> Reloading Commands <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--><!--[--><p class="sidebar-heading sidebar-item">
42Slash Commands</p><ul class=""><li><!--[--><a aria-label='Command response methods' class='nav-link sidebar-item' href='/slash-commands/response-methods'><!--[--><!--]--> Command response methods <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Advanced command creation' class='nav-link sidebar-item' href='/slash-commands/advanced-creation'><!--[--><!--]--> Advanced command creation <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Parsing options' class='nav-link sidebar-item' href='/slash-commands/parsing-options'><!--[--><!--]--> Parsing options <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Slash command permissions' class='nav-link sidebar-item' href='/slash-commands/permissions'><!--[--><!--]--> Slash command permissions <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Autocomplete' class='nav-link sidebar-item' href='/slash-commands/autocomplete'><!--[--><!--]--> Autocomplete <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Deleting commands' class='nav-link sidebar-item' href='/slash-commands/deleting-commands'><!--[--><!--]--> Deleting commands <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--><!--[--><p class="sidebar-heading sidebar-item">Interactive Components</p><ul class=""><li><!--[--><a aria-label='Action rows' class='nav-link sidebar-item' href='/interactive-components/action-rows'><!--[--><!--]--> Action rows <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Buttons' class='nav-link sidebar-item' href='/interactive-components/buttons'><!--[--><!--]--> Buttons <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Select menus' class='nav-link sidebar-item' href='/interactive-components/select-menus'><!--[--><!--]--> Select menus <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Component interactions' class='nav-link sidebar-item' href='/interactive-components/interactions'><!--[--><!--]--> Component interactions <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--><!--[--><p class="sidebar-heading sidebar-item">Other Interactions</p><ul class=""><li><!--[--><a aria-label='Modals' class='nav-link sidebar-item' href='/interactions/modals'><!--[--><!--]--> Modals <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Context Menus' class='nav-link sidebar-item' href='/interactions/context-menus'><!--[--><!--]--> Context Menus <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--><!--[--><p class="sidebar-heading sidebar-item">Popular Topics</p><ul class=""><li><!--[--><a aria-label='Frequently asked Questions' class='nav-link sidebar-item' href='/popular-topics/faq'><!--[--><!--]--> Frequently asked Questions <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Working with Audit Logs' class='nav-link sidebar-item' href='/popular-topics/audit-logs'><!--[--><!--]--> Working with Audit Logs <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Image manipulation with @napi-rs/canvas' class='nav-link sidebar-item' href='/popular-topics/canvas'><!--[--><!--]--> Image manipulation with @napi-rs/canvas <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Collectors' class='nav-link sidebar-item' href='/popular-topics/collectors'><!--[--><!--]--> Collectors <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Display Components' class='nav-link sidebar-item' href='/popular-topics/display-components'><!--[--><!--]--> Display Components <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Embeds' class='nav-link sidebar-item' href='/popular-topics/embeds'><!--[--><!--]--> Embeds <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Errors' class='nav-link sidebar-item' href='/popular-topics/errors'><!--[--><!--]--> Errors <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Formatters' class='nav-link sidebar-item' href='/popular-topics/formatters'><!--[--><!--]--> Formatters <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Gateway Intents' class='nav-link sidebar-item' href='/popular-topics/intents'><!--[--><!--]--> Gateway Intents <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Partial Structures' class='nav-link sidebar-item' href='/popular-topics/partials'><!--[--><!--]--> Partial Structures <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Permissions' class='nav-link sidebar-item' href='/popular-topics/permissions'><!--[--><!--]--> Permissions <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Permissions (extended)' class='nav-link sidebar-item' href='/popular-topics/permissions-extended'><!--[--><!--]--> Permissions (extended) <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Reactions' class='nav-link sidebar-item' href='/popular-topics/reactions'><!--[--><!--]--> Reactions <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Threads' class='nav-link sidebar-item' href='/popular-topics/threads'><!--[--><!--]--> Threads <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Webhooks' class='nav-link sidebar-item' href='/popular-topics/webhooks'><!--[--><!--]--> Webhooks <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--><!--[--><p class="sidebar-heading sidebar-item">Miscellaneous</p><ul class=""><li><!--[--><a aria-label='Cache customization' class='nav-link sidebar-item' href='/miscellaneous/cache-customization'><!--[--><!--]--> Cache customization <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Useful packages' class='nav-link sidebar-item' href='/miscellaneous/useful-packages'><!--[--><!--]-->
42 Useful packages <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--><!--[--><p class="sidebar-heading sidebar-item">Databases</p><ul class=""><li><!--[--><a href="/sequelize/" class="nav-link sidebar-item" aria-label="Storing data with Sequelize"><!--[--><!--]--> Storing data with Sequelize <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Making a Currency System' class='nav-link sidebar-item' href='/sequelize/currency'><!--[--><!--]--> Making a Currency System <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a href="/keyv/" class="nav-link sidebar-item" aria-label="Storing data with Keyv"><!--[--><!--]--> Storing data with Keyv <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--><!--[--><p class="sidebar-heading sidebar-item">Sharding</p><ul class=""><li><!--[--><a href="/sharding/" class="nav-link sidebar-item" aria-label="Getting started"><!--[--><!--]--> Getting started <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Additional information' class='nav-link sidebar-item' href='/sharding/additional-information'><!--[--><!--]--> Additional information <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Extended changes' class='nav-link sidebar-item' href='/sharding/extended'><!--[--><!--]--> Extended changes <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--><!--[--><p class="sidebar-heading sidebar-item">OAuth2</p><ul class=""><li><!--[--><a href="/oauth2/" class="nav-link sidebar-item" aria-label="Getting started with OAuth2"><!--[--><!--]--> Getting started with OAuth2 <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--><!--[--><p class="sidebar-heading sidebar-item">Improving Your Dev Environment</p><ul class=""><li><!--[--><a aria-label='Managing your bot process with PM2' class='nav-link sidebar-item' href='/improving-dev-environment/pm2'><!--[--><!--]--> Managing your bot process with PM2 <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Setting up package.json scripts' class='nav-link sidebar-item' href='/improving-dev-environment/package-json-scripts'><!--[--><!--]--> Setting up package.json scripts <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--><!--[--><p class="sidebar-heading sidebar-item">Additional Information</p><ul class=""><li><!--[--><a aria-label='Understanding notation' class='nav-link sidebar-item' href='/additional-info/notation'><!--[--><!--]--> Understanding notation <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='ES6 syntax examples' class='nav-link sidebar-item' href='/additional-info/es6-syntax'><!--[--><!--]--> ES6 syntax examples <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Collections' class='nav-link sidebar-item' href='/additional-info/collections'><!--[--><!--]--> Collections <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Understanding async/await' class='nav-link sidebar-item' href='/additional-info/async-await'><!--[--><!--]--> Understanding async/await <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Using a REST API' class='nav-link sidebar-item' href='/additional-info/rest-api'><!--[--><!--]--> Using a REST API <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Updating from v12 to v13' class='nav-link sidebar-item' href='/additional-info/changes-in-v13'><!--[--><!--]--> Updating from v12 to v13 <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-label='Updating from v13 to v14' class='nav-link sidebar-item' href='/additional-info/changes-in-v14'><!--[--><!--]--> Updating from v13 to v14 <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--><!--]--></ul><!--[--><!--]--></aside></div><main class="page"><!--[--><!--]--><div class="theme-default-content"><!--[--><h1 id="installing-node-js-and-discord-js" tabindex="-1"><a class="header-anchor" href="#installing-node-js-and-discord-js" aria-hidden="true">#</a> Installing Node.js and discord.js</h1><h2 id="installing-node-js" tabindex="-1"><a class="header-anchor" href="#installing-node-js" aria-hidden="true">#</a> Installing Node.js</h2><p>To use discord.js, you&#39;ll need to install the latest LTS version of <a href="https://nodejs.org/" target="_blank" rel="noopener noreferrer">Node.js<span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15">
42<path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span></a>.</p><div class="custom-container tip"><p class="custom-container-title">TIP</p><p>To check if you already have Node installed on your machine (e.g., if you&#39;re using a VPS), run <code>node -v</code> in your terminal. It is recommended to use the latest LTS version of Node.</p></div><p>On Windows, it&#39;s as simple as installing any other program. Download the latest version from <a href="https://nodejs.org/" target="_blank" rel="noopener noreferrer">the Node.js website<span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span></a>, open the downloaded file, and follow the steps from the installer.</p><p>On macOS, either:</p><ul><li>Download the latest version from <a href="https://nodejs.org/" target="_blank" rel="noopener noreferrer">the Node.js website<span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span></a>, open the package installer, and follow the instructions</li><li>Use a package manager like <a href="https://brew.sh/" target="_blank" rel="noopener noreferrer">Homebrew<span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span></a> with the command <code>brew install node</code></li></ul><p>On Linux, you can consult <a href="https://nodejs.org/en/download/package-manager/" target="_blank" rel="noopener noreferrer">this page<span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span></a> to determine how you should install Node.</p><h2 id="preparing-the-essentials" tabindex="-1"><a class="header-anchor" href="#preparing-the-essentials" aria-hidden="true">#</a> Preparing the essentials</h2><p>To use discord.js, you&#39;ll need to install it via npm (Node&#39;s package manager). npm comes with every Node installation, so you don&#39;t have to worry about installing that. However, before you install anything, you should set up a new project folder.</p><p>Navigate to a suitable place on your machine and create a new folder named <code>discord-bot</code> (or whatever you want). Next you&#39;ll need to open your terminal.</p><h3 id="opening-the-terminal" tabindex="-1"><a class="header-anchor" href="#opening-the-terminal" aria-hidden="true">
42#</a> Opening the terminal</h3><div class="custom-container tip"><p class="custom-container-title">TIP</p><p>If you use <a href="https://code.visualstudio.com/" target="_blank" rel="noopener noreferrer">Visual Studio Code<span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span></a>, you can press <code>Ctrl + `</code> (backtick) to open its integrated terminal.</p></div><p>On Windows, either:</p><ul><li><code>Shift + Right-click</code> inside your project directory and choose the &quot;Open command window here&quot; option</li><li>Press <code>Win + R</code> and run <code>cmd.exe</code>, and then <code>cd</code> into your project directory</li></ul><p>On macOS, either:</p><ul><li>Open Launchpad or Spotlight and search for &quot;Terminal&quot;</li><li>In your &quot;Applications&quot; folder, under &quot;Utilities&quot;, open the Terminal app</li></ul><p>On Linux, you can quickly open the terminal with <code>Ctrl + Alt + T</code>.</p><p>With the terminal open, run the <code>node -v</code> command to make sure you&#39;ve successfully installed Node.js.</p><h3 id="initiating-a-project-folder" tabindex="-1"><a class="header-anchor" href="#initiating-a-project-folder" aria-hidden="true">#</a> Initiating a project folder</h3><div class="code-group"><div class="code-group__nav"><ul class="code-group__ul"><li class="code-group__li"><button class="code-group__nav-tab code-group__nav-tab-active" ariapressed="true" ariaexpanded="true">npm</button></li><li class="code-group__li"><button class="code-group__nav-tab" ariapressed="false" ariaexpanded="false">yarn</button></li><li class="code-group__li"><button class="code-group__nav-tab" ariapressed="false" ariaexpanded="false">pnpm</button></li><li class="code-group__li"><button class="code-group__nav-tab" ariapressed="false" ariaexpanded="false">bun</button></li></ul></div><!--[--><div class="code-group-item" aria-selected="false"><!--[--><div class="language-bash ext-sh"><pre class="language-bash"><code><span class="token function">npm</span> init
43</code></pre></div><!--]--></div><div class="code-group-item" aria-selected="false"><!--[--><div class="language-bash ext-sh"><pre class="language-bash"><code><span class="token function">yarn</span> init
44</code></pre></div><!--]--></div><div class="code-group-item" aria-selected="false"><!--[--><div class="language-bash ext-sh"><pre class="language-bash"><code><span class="token function">pnpm</span> init
45</code></pre></div><!--]--></div><div class="code-group-item" aria-selected="false"><!--[--><div class="language-bash ext-sh"><pre class="language-bash"><code>bun init
46</code></pre></div><!--]--></div><!--]--></div><p>This is the next command you&#39;ll be running. This command creates a <code>package.json</code> file for you, which will keep track of the dependencies your project uses, as well as other info.</p><p>This command will ask you a sequence of questions–you should fill them out as you see fit. If you&#39;re not sure of something or want to skip it as a whole, leave it blank and press enter.</p><div class="custom-container tip"><p class="custom-container-title">TIP</p><p>To get started quickly, you can run the following command to have it fill out everything for you.</p><div class="code-group"><div class="code-group__nav"><ul class="code-group__ul"><li class="code-group__li"><button class="code-group__nav-tab code-group__nav-tab-active" ariapressed="true" ariaexpanded="true">npm</button></li><li class="code-group__li"><button class="code-group__nav-tab" ariapressed="false" ariaexpanded="false">yarn</button></li><li class="code-group__li"><button class="code-group__nav-tab" ariapressed="false" ariaexpanded="false">pnpm</button></li><li class="code-group__li"><button class="code-group__nav-tab" ariapressed="false" ariaexpanded="false">bun</button></li></ul></div><!--[--><div class="code-group-item" aria-selected="false"><!--[--><div class="language-bash ext-sh"><pre class="language-bash"><code><span class="token function">npm</span> init <span class="token parameter variable">-y</span>
47</code></pre></div><!--]--></div><div class="code-group-item" aria-selected="false"><!--[--><div class="language-bash ext-sh"><pre class="language-bash"><code><span class="token function">yarn</span> init <span class="token parameter variable">-y</span>
48</code></pre></div><!--]--></div><div class="code-group-item" aria-selected="false"><!--[--><div class="language-bash ext-sh"><pre class="language-bash"><code><span class="token function">pnpm</span> init
49</code></pre></div><!--]--></div><div class="code-group-item" aria-selected="false"><!--[--><div class="language-bash ext-sh"><pre class="language-bash"><code>bun init <span class="token parameter variable">-y</span>
50</code></pre></div><!--]--></div><!--]--></div></div><p>Once you&#39;re done with that, you&#39;re ready to install discord.js!</p><h2 id="installing-discord-js" tabindex="-1"><a class="header-anchor" href="#installing-discord-js" aria-hidden="true">
50#</a> Installing discord.js</h2><p>Now that you&#39;ve installed Node.js and know how to open your console and run commands, you can finally install discord.js! Run the following command in your terminal:</p><div class="code-group"><div class="code-group__nav"><ul class="code-group__ul"><li class="code-group__li"><button class="code-group__nav-tab code-group__nav-tab-active" ariapressed="true" ariaexpanded="true">npm</button></li><li class="code-group__li"><button class="code-group__nav-tab" ariapressed="false" ariaexpanded="false">yarn</button></li><li class="code-group__li"><button class="code-group__nav-tab" ariapressed="false" ariaexpanded="false">pnpm</button></li><li class="code-group__li"><button class="code-group__nav-tab" ariapressed="false" ariaexpanded="false">bun</button></li></ul></div><!--[--><div class="code-group-item" aria-selected="false"><!--[--><div class="language-bash ext-sh"><pre class="language-bash"><code><span class="token function">npm</span> <span class="token function">install</span> discord.js
51</code></pre></div><!--]--></div><div class="code-group-item" aria-selected="false"><!--[--><div class="language-bash ext-sh"><pre class="language-bash"><code><span class="token function">yarn</span> <span class="token function">add</span> discord.js
52</code></pre></div><!--]--></div><div class="code-group-item" aria-selected="false"><!--[--><div class="language-bash ext-sh"><pre class="language-bash"><code><span class="token function">pnpm</span> <span class="token function">add</span> discord.js
53</code></pre></div><!--]--></div><div class="code-group-item" aria-selected="false"><!--[--><div class="language-bash ext-sh"><pre class="language-bash"><code>bun <span class="token function">add</span> discord.js
54</code></pre></div><!--]--></div><!--]--></div><p>And that&#39;s it! With all the necessities installed, you&#39;re almost ready to start coding your bot.</p><h2 id="installing-a-linter" tabindex="-1"><a class="header-anchor" href="#installing-a-linter" aria-hidden="true">#</a> Installing a linter</h2><p>While you are coding, it&#39;s possible to run into numerous syntax errors or code in an inconsistent style. You should <a class href='/preparations/setting-up-a-linter'>install a linter</a> to ease these troubles. While code editors generally can point out syntax errors, linters coerce your code into a specific style as defined by the configuration. While this is not required, it is advised.</p><!--]--></div><footer class="page-meta"><div class="meta-item edit-link"><a class="nav-link external meta-item-label" href="https://github.com/discordjs/guide/edit/main/guide/preparations/README.md" rel="noopener noreferrer" target="_blank" aria-label="Edit this page"><!--[--><!--]--> Edit this page <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariahidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></div><div class="meta-item last-updated"><span class="meta-item-label">Last Updated: </span><span class="meta-item-info">9/7/2024, 6:12:24 PM</span></div><!----></footer><nav class="page-nav"><p class="inner"><!----><span class="next"><a aria-label='Setting up a linter' class='nav-link' href='/preparations/setting-up-a-linter'><!--[--><!--]--> Setting up a linter <!--[--><!--]--></a> → </span></p></nav><!--[--><!--]--></main></div></div><!----><!--]--></div>
55	
55<script type="module" src="/assets/app.1a0d0096.js" defer></script>
55
56</body>
57</html>

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.