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 Quadratic

Free AI chart generator

Upload data, describe your vision, and get Python-powered, AI-generated charts instantly.

Try Quadratic free

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Explore a trove of insights in this engaging article, celebrated within our welcoming DEV Community. Developers from every background are invited to join and enhance our shared wisdom.

A genuine "thank you" can truly uplift someone’s day. Feel free to express your gratitude in the comments below!

On DEV, our collective exchange of knowledge lightens the road ahead and strengthens our community bonds. Found something valuable here? A small thank you to the author can make a big difference.

Okay