Closed proCoderSid closed 11 months ago
Since this is a feature I'm not implementing in NVM4W, I'm closing this. However; I'm going to link to this from the wiki for people who want this functionality.
This now linked in the common issues wiki page.
Just for those trying to use this script, it doesn't work with 1.1.12. However, it does work with 1.1.11. See https://github.com/coreybutler/nvm-windows/issues/1068
In addition I had to tweak two lines because when comparing values it would fail since some versions have leading "v" before version i.e. 'v18.0.0' === '18.0.0'
would fail, though technically they are the same version.
currentVersion = currentVersion.startsWith( 'v' ) ? currentVersion.slice( 1 ) : currentVersion;
Description of the new feature / enhancement
I have created this script and it is for user convince to go to check script
Automatic Node.js Version Checker Script
This JavaScript script automates the process of checking and managing Node.js versions based on specific conditions:
Check Current Node.js Version:
Comparison with Required Version from
.nvmrc
File:Using Node Version from
.nvmrc
File:.nvmrc
file in your project directory..nvmrc
file is found and contains a valid Node.js version, the script switches to and uses that version.Installing Missing Node.js Version:
.nvmrc
file or the specified version is not installed, the script prompts the user with a confirmation message.nvm install version
commandTerminating the Script:
This script provides an automated and user-friendly way to ensure that your Node.js environment is set to the required version for your project.
Usage
the script is available at https://github.com/proCoderSid/nvm-chk.git
You can use this file in
package.json
file as follow or as you feel comfortable to useI have tested this script in node v4.9.11 to latest, It works fine and if not working in any specific version then let me know I will update the script
Prerequisites as follow
Scenario when this would be used?
Supporting information