Super handy, but we had to run the command manually. The output will be something like this: Found '/PATH/TO/YOUR/REPO/.nvmrc' with version Now using node v16.16.0 (npm v8.11.0) nvmrc in the root of your project, and you put the version number inside, you can run the use command without any arguments: nvm use This file is a simple text file that contains the version we want to use for the current project. Sure, we can find it easily in the package.json under the key engines if specified, but then we have to manually type the version in the terminal. What we’ve seen so far is super cool, but we don’t want to keep in mind which version we’re using for each project. This is actually quite handy if you need to run multiple projects with different versions at the same time (let’s say backend and frontend of your project). If you open a terminal in a different folder, you’ll find yourself in the default version again. Note: changes are local to the terminal where you’re running the command. If you install a version by mistake, or you simply want to remove one for some reason, you can use the uninstall command: nvm uninstall 18.14.0 Or again in case you have multiple minor versions: nvm use 18.14.0 You can switch between them using the use command: nvm use 18 You can also specify minor and patch versions, for example: nvm install 18.14.0Īt this point, you’ll end up having two different versions of Node.js installed on your machine. You can check the current version with: node -v This will install Node.js 16 and make it the default version. You can find the list of available versions here: įor example, if you want to install Node.js 16, you can run: nvm install 16 The first thing you need to do is to install the Node.js version you want to use. Once installed, you can use the nvm command in your terminal. The quickest way for windows is to use the installer, while for Linux/MacOS you can use the curl command (copy-paste it into your terminal). In both cases, you will find plenty of documentation already in the README, so I won’t go too much into detail here. One is for Windows, the other one is for Mac and Linux. They’re both called nvm, but they’re not exactly the same, nor they’re meant to be. Depending on your OS, you will find two different tools.
0 Comments
Leave a Reply. |