check node and npm version on install

This commit is contained in:
Peter 'Pita' Martischka 2011-08-11 15:09:05 +01:00
parent 39bc588ae7
commit 4b892ae4ff
1 changed files with 14 additions and 0 deletions

View File

@ -20,12 +20,26 @@ hash node > /dev/null 2>&1 || {
exit 1
}
#check node version
NODE_VERSION=$(node --version)
if [ ! $(echo $NODE_VERSION | cut -d "." -f 1-2) = "v0.4" ]; then
echo "You're running a wrong version of node, you're using $NODE_VERSION, we need v0.4.x" >&2
exit 1
fi
#Is npm installed?
hash npm > /dev/null 2>&1 || {
echo "Please install npm ( http://npmjs.org )" >&2
exit 1
}
#check npm version
NPM_VERSION=$(npm --version)
if [ ! $(echo $NPM_VERSION | cut -d "." -f 1-2) = "1.0" ]; then
echo "You're running a wrong version of npm, you're using $NPM_VERSION, we need 1.0.x" >&2
exit 1
fi
#Does a settings.json exist? if no copy the template
if [ ! -f "settings.json" ]; then
echo "Copy the settings template to settings.json..."