Created
August 9, 2021 23:09
-
-
Save z7pz/14fc73c8e64078cd4dd0b56bb7b91783 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { execSync } = require('child_process'); | |
const version = process.versions.node.split('.')[0]; | |
console.log(process.env.NODE_VERSION); | |
(async () => { | |
console.info('[LOG]: CHECKING NODE VERSION...') | |
if (version == '16') { | |
console.info(`[LOG]: NODE VERSION IS ${version}`) | |
} else { | |
const command = execSync(`npm init -y && npm i --save-dev node@latest && npm config set prefix=$(pwd)/node_modules/node && export PATH=$(pwd)/node_modules/node/bin:$PATH`).toString() | |
console.log('[LOG]: CLEARING IN 10 SECONDS.') | |
if (!command) return console.error('error in type the installing command') | |
setTimeout(() => { | |
execSync('clear'); | |
}, 10000) | |
} | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment