DEV Community

AozoraDev
AozoraDev

Posted on

2 1

Getting Node.js 16 in Replit

Hey! It's me, Aozora and this is my first post on DEV.

Anyway, get to the point.
Discord.js v13 has been released with additional features like slash command, button, select menu, and context menu (coming soon) but Discord.js v13 requires Node.js 16.6 or above to work properly.
Unfortunately this is a nightmare for Replit users because Replit only supports v12 for Node.js and v14 for Bash.

Hey, don't worry. Here I will tell you the solution. Did you know that Replit has just released Nix (Beta) as a new programming language choice?
Well... We'll use that.
Oh, you don't know what Nix is?
You guys look it up yourself on Wikipedia because I'm... you know, kind of lazy.
Anyway, let's get started.

  1. Go grab some snacks because reading without eating is boring.

  2. Create a new project in your Replit then select Nix (beta) as your project language.
    DaProject

  3. After the editor opens, press 3 dots (I don't know what it's called) then press Show config files.
    DaOptions

  4. Press the replit.nix file , delete all the codes that writed on it, then type this code (or you can use Ctrl + C and Ctrl + V if you are lazy.

    { pkgs }: {
      deps = [
        pkgs.nodejs-16_x
      ];
    }
    
  5. Press the .replit file then type this.

    run = "npm start"
    
  6. Don't forget to add this in your package.json.

      "scripts": {
        "start": "node index.js"
      },
    

After everything is done, run your project and something like Loading Nix environment... will appear in your project console.
And we're done. Now you can use Discord.js v13 in your Replit project.

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

Top comments (0)

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay