Enforce correct .nvmrc version when running npm scripts
npm install nvm-guard --save-dev
nvm-guard
protects your npm scripts for being ran with wrong Node.js version.
Make sure that all contributors are using the specified version and avoid unnecessary dependency hassle.
In your package.json
add nvm-guard
as a pre-hook or before the scripts you want to protect.
{
"scripts": {
// When running npm run eslint, we'll first call nvm-guard, then ESLint if nvm-guard passes
"eslint": "nvm-guard && eslint src/",
// Will be called before npm test
// npm docs: https://docs.npmjs.com/misc/scripts
"pretest": "nvm-guard",
}
}
- compatible-version - API for this module
MIT © Daniel Eckermann