Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check Node version for a specific project?

Tags:

node.js

npm

I have Node version 16.13.1 installed globally in my machine. I have a project where I want to downgrade the version to 14.19.1. I used the command npm install [email protected] --save-exact to downgrade, and this version is reflecting in my package.json file.

The problem is, when I run node -v at my project's root folder, the version is returned as 16.13.1. To check this, I made an entry in scripts in package.json - "v": "node -v". When I run npm run v, the output is 14.19.1.

It's clear that my project's Node version was downgraded successfully. So, why does Node show me the global version when I check it from my project's folder? Is there flag to use with node -v to check the local version?

like image 225
Sh4dy Avatar asked Sep 16 '26 13:09

Sh4dy


1 Answers

To use multiple node versions in your system you have to use nvm. Which is useful to install multiple node versions and easy to switch node versions as per project requirements. NVM Installation Guid

like image 190
Mihir Shah Avatar answered Sep 18 '26 06:09

Mihir Shah



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!