Search code examples
node.jsstrapi

Node version v21.6.1 when connect with strapi then showing "Strapi requires Node.js >=18.0.0 <=20.x.x"


How to downgrade Node.js version from 21 to 20 using Node Version Manager (NVM)?

I am working on a project that requires Node.js version 20.x.x. However, my development environment is configured with Node.js version 21.6.1. I need to downgrade Node.js to version 20 using Node Version Manager (NVM) in my Visual Studio Code terminal.

Could someone please provide step-by-step instructions on how to accomplish this task?

I'm looking for guidance on how to:

  • Install Node Version Manager (NVM) if it's not already installed.
  • Download and install Node.js version 20 using NVM.
  • Set Node.js version 20 as the active version in my Visual Studio Code terminal.
  • Verify that the installation was successful and I'm now using Node.js version 20.

enter image description here


Solution

  • knowing nvm made my life actually better :). To install:

    1. Follow this wonderful article https://www.freecodecamp.org/news/node-version-manager-nvm-install-guide/. Get used to bash scripting, you will need it more than you think onwards.
    2. If you can execute nvm --version on your terminal, then it is properly installed.
    3. To install the node version you want, just execute nvm install <<version>>. So for node 20.1.5, you can execute nvm install 20.1.5.
    4. Then execute nvm use <<version>> to use the node version.
    5. To check the node version, execute node --version.