nodengine v3.5.0
nodengine is an automatic way to switch your Node.js version per project reading engines fields at package.json.
It needs a global version manager as n or nvm.
If you want know when a new version of node is released, follow our @nodengine bot.
Install
$ npm install nodengine --global --productionUsage
Set the desired version range in the package.json
"engines": {
"node": ">= 0.10"
}Then just run nodengine to change the current node version to version declared into package.json.
It will use the highest version that satisfies the range.
Automatic switching
Enabling automatic switching consist in a little shell script for check if package.json exists and then runs nodengine.
Add the follow snippet in a file loaded by your shell agent, for example, .extra.
function chpwd() {
local PKG
PKG=$PWD/package.json
if [ -f "$PKG" ] && [ "$NODENGINE_LAST_DIR" != "$PWD" ]; then
nodengine
printf "\033[36m%s\033[0m \033[90m%s\033[0m\n" "nodengine" "$(node --version)"
NODENGINE_LAST_DIR=$PWD
fi
}
function cd() { builtin cd "$@" && chpwd; }
function pushd() { builtin pushd "$@" && chpwd; }
function popd() { builtin popd "$@" && chpwd; }Fetching new versions
The program use a local cache for avoid fetching versions of node all the time.
By default, new versions of node will be fetched after 5 days.
You can setup the interval using NODENGINE_INTERVAL
For example, if you want to fetch all versions every time that you run the program:
NODENGINE_INTERVAL=0 nodengineLicense
MIT © Kiko Beats
3 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
8 years ago
8 years ago
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago