The npm registry includes a package called “node”. It is a regular npm package that contains only the Node.js binary.
So, in your directory in question run:
npm install node@your.desired.version --save-exact
Then, put a script in your package.json as follows:
"scripts": {
"v": "node -v"
}
To verify, run node -v in your terminal in the root of the project and you should see the version you have set on your machine. Compare that by running npm run v and you should see the version you have set for the project. This way, you can seamlessly move about your file system and execute various builds without changing your global node configuration.
In principle, every executable file that arrives with an npm package is linked to the local binaries directory within the project. It means that when we install such a package, we could find a link for its executable file inside.
Note: set node engine to advise – “this field is advisory only and will only produce warnings when your package is installed as a dependency.”