auto-set-node-version
v1.0.3
Published
automatically set node version (based on package.json), when 'npm start' command is run.
Downloads
9
Maintainers
Readme
auto-set-node-version
automatically set node version...
- an example code is provided in below section for ease.
- When you run npm-script (example taken for
npm start), - it reads
package.jsonfor the node version required for your project, - and, switches the node version.
- Note: Assuming, you are using
nvmfor using different node versions.
How to use / consume this npm-package
$ npm install [email protected] --save-dev- Update your project's
package.jsonfile:
"scripts": {
"prestart": "npm run set-node",
"start": "node -e \"console.log('%s: Define your task (npm start).', Date())\" && exit 1",
"set-node": "node ./node_modules/auto-set-node-version/index.js"
}
"devDependencies": {
"auto-set-node-version": "^1.0.3"
},
"engines": {
"node": ">=12.14.1"
},- Done!
Compatibility:
Windows: tested & works well.*nix: NOT supported. Reason: executing nvm as a command in child process doesn't work as it's not a terminal-command (it runs as shell-function).
