Skip to content

Instantly share code, notes, and snippets.

@thibmaek
Created March 28, 2017 09:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thibmaek/b786c21a867f61c91cb9ab811c8a3480 to your computer and use it in GitHub Desktop.
Save thibmaek/b786c21a867f61c91cb9ab811c8a3480 to your computer and use it in GitHub Desktop.
Get node engine from package.json
# Given engine.node = 6.10.1 in package.json
# will output 6.10.1 in the shell
cat package.json | grep \"node\": | grep -E -o '(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)'
# Why? Auto install package.json version to nvm
cat package.json | grep \"node\": | grep -E -o '(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)' | nvm install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment