Skip to main content
Version: 0.10

Environment

Set up and maintain your developer environment.

Requirements

Make sure you have the following software installed:

  • Node.js v18.18.2 or higher
  • Node.js package manager: either npm or Yarn
  • Git v2.28.0 or higher
  • the latest version of Chrome or Firefox

You'll also need an editor for viewing and editing code (we recommend VS Code).

note

If you've never installed Node.js on your computer, please use the installation instructions below.

Install Node.js

Click here for instructions on installing Node.js
You’re going to work with TypeScript. In order for Typescript to work with Devvit, you’ll need a working Node.js environment and then the Devvit command line interface. Node.js is an open-source server environment that makes it possible to develop and run Javascript apps anywhere. Node.js lets you import and use packages (code that other people have written) into your code.

Option 1: Use node version manager (nvm)

Install or update nvm to use as a handy command-line tool for managing multiple Node.js versions on your system. This will allow you to switch between different versions easily. If you to use a different node version manager, check out these suggestions from npmjs.org.

For macOS or Linux:

  1. Run the following command line in your terminal to install nvm.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.6/install.sh | bash
  1. Close and re-open your terminal to have nvm available.

  2. Install the latest version of Node.js.

nvm install node

For Windows:

  1. Download and install nvm-windows by following the instructions in the repository.

  2. Restart your terminal or command prompt.

  3. Install the latest version of Node.js.

nvm install node

Option 2: Use Node.js installer from nodejs.org

  1. Visit the official Node.js website to download the installer for your operating system (Windows, macOS, or Linux).
  2. Run the installer and follow the prompts to install Node.js and npm (the package manager for Node.js).
note

If you install Node.js this way, you may experience permissions issues when trying to run Devvit, which is documented on NPM's website. Both NPM and us here at Reddit highly encourage you to use nvm if possible. If that's not possible, here are some tips on how to fix these permissions issues. For Windows users specifically, please use a node version manager.

Verify Node.js installation

Check that Node.js is installed correctly by running the following commands:

node --version
npm --version

You should see the version numbers for Node.js and npm as output.


Install the Devvit CLI

To download and install the Devvit CLI, run one of the following commands:

npm install -g devvit

-OR-

yarn global add devvit
note

If you see permission errors, please read npm's official guide . Yarn depends on the same configuration as npm.

Login to Devvit

Use your Reddit username to log into Devvit. When you run the Devvit login, a Reddit authentication page will open in your browser (if the page doesn’t open automatically, you can use the link in the command line output).

The Devvit login will run until you follow the link and complete the authentication process.

Run:

devvit login
note

If you can't log in, make sure you are using a Reddit account that has been allowlisted for the Reddit Developer Platform.

To verify your authentication, run:

devvit whoami

The output will be similar to this:

Logged in as u/yourredditusername

Update the Devvit CLI

To update your Devvit CLI, first you'll need to uninstall the existing version. Run:

npm -g uninstall @devvit/cli

Then install the updated Devvit CLI:

npm install -g devvit
note

This assumes you have installed Node.js and have npm available. If you are unsure if these tools are installed, see our Quickstart

Upgrade your app to the latest version of Devvit

You'll need to upgrade existing apps to the latest version of Devvit if you plan to use any features in the new release. You can do this using devvit update app.

First, move into the top-level directory of your app


my-simpler-project # <- you should be here
├── devvit.yaml
├── package.json
├── src
│ └── main.ts
├── tsconfig.json
├── yarn.lock

Next, run:

devvit update app

Finally, you can check the version of Devvit your app is using by looking in the top-level package.json file.


my-simpler-project
├── devvit.yaml
├── package.json # <- open this file
├── src
│ └── main.ts
├── tsconfig.json
├── yarn.lock

You should see the devvit version under devDependencies:

{
"name": "mrt-0-8-remind-me",
"version": "0.0.0",
"type": "module",
"private": true,
"license": "BSD-3-Clause",
"main": "index.js",
"workspaces": [
"actors/my-actor"
],
"devDependencies": {
"@devvit/tsconfig": "0.8.0", #<- should be the new version of devvit
"typescript": "4.9.3"
},
}