DEV Community

DET171
DET171

Posted on

5 2

How to manage your Node.js version on Replit

How to manage your Node.js version on Replit

  1. First, go to Replit and create a REPL. Select BASH and NOT Node.js (We'll install it later). Funnily enough, at the time of writing, if you ran node -v, you would see v14.17.1 (which is an LTS version, and also considering we didn't install Node).
  2. Select Shell (which is just beside Console)
  3. Copy and paste the following code below into Shell. On Windows, it's Ctrl+Shift+V. You can change the 16 below to any version you desire.
  curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
  export NVM_DIR="/config/nvm"
  [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
  [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
  nvm install 16 
  nvm use 16
Enter fullscreen mode Exit fullscreen mode
  1. Wait for a while. You may choose to go to the toilet or grab a few bites in the meantime.
  2. After the code below has finished running and installing Node.js, run node -v && npm -v. You should see an updated Node.js (v16.x.x) and NPM (v8.x.x at time of writing) version.
  3. Run the following to test:
 echo console.log(`Node version: ${process.versions.node}`) > test.js
 node test.js
Enter fullscreen mode Exit fullscreen mode

You should now see an updated/different Node version, depending on which version you installed and used earlier on.

That's it! You can now install and use any Node.js version you wish!

Post was last updated on 10/10/2021

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

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

Okay