Error check after npm install added

While running ``npm install`` there might be errors occurring due to repository maintenance/problems or when the network connection drops while downloading a package. To detect this I've added checks that abort after a failed installation.
This commit is contained in:
Candle 2020-08-06 14:25:00 +02:00
parent 32f4312d15
commit 8924c05d2d
6 changed files with 32 additions and 9 deletions

View file

@ -61,6 +61,10 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
# check latest version:
# https://github.com/alexbosworth/balanceofsatoshis/blob/master/package.json#L70
sudo -u bos npm install -g balanceofsatoshis@5.41.0
if ! [ $? -eq 0 ]; then
echo "FAIL - npm install did not run correctly, aborting"
exit 1
fi
# setting value in raspi blitz config
sudo sed -i "s/^bos=.*/bos=on/g" /mnt/hdd/raspiblitz.conf

View file

@ -119,6 +119,10 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
cd btc-rpc-explorer
sudo -u btcrpcexplorer git reset --hard v2.0.0
sudo -u btcrpcexplorer npm install
if ! [ $? -eq 0 ]; then
echo "FAIL - npm install did not run correctly, aborting"
exit 1
fi
# prepare .env file
echo "# getting RPC credentials from the ${network}.conf"

View file

@ -46,6 +46,10 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
sudo -u $USERNAME rm v$APP_VERSION.tar.gz
cd kindle-display/server
sudo -u $USERNAME npm install
if ! [ $? -eq 0 ]; then
echo "FAIL - npm install did not run correctly, aborting"
exit 1
fi
# setup kindle-display config
RPC_USER=$(sudo cat /mnt/hdd/${network}/${network}.conf | grep rpcuser | cut -c 9-)

View file

@ -104,17 +104,15 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo "*** Run: npm install ***"
export NG_CLI_ANALYTICS=false
sudo -u rtl npm install --only=prod
if ! [ $? -eq 0 ]; then
echo "FAIL - npm install did not run correctly, aborting"
exit 1
else
echo "OK - RTL install looks good"
echo ""
fi
cd ..
# check if node_modules exist now
if [ -d "/home/rtl/RTL/node_modules" ]; then
echo "OK - RTL install looks good"
else
echo "FAIL - npm install did not run correctly"
echo "ABORT - RTL install"
exit 1
fi
echo ""
# prepare RTL-Config.json file
echo "*** RTL.conf ***"

View file

@ -38,6 +38,10 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
sudo -u $USERNAME rm v$SCRIPT_VERSION.tar.gz
cd stacking-sats-kraken
sudo -u $USERNAME npm install
if ! [ $? -eq 0 ]; then
echo "FAIL - npm install did not run correctly, aborting"
exit 1
fi
# setup stacking config
sudo mkdir -p $APP_DATA_DIR

View file

@ -84,6 +84,11 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
sudo -u thunderhub git reset --hard v0.8.12
echo "Running npm install and run build..."
sudo -u thunderhub npm install
if ! [ $? -eq 0 ]; then
echo "FAIL - npm install did not run correctly, aborting"
exit 1
fi
sudo -u thunderhub npm run build
###############
@ -293,6 +298,10 @@ if [ "$1" = "update" ]; then
# install deps
echo "Installing dependencies..."
sudo -u thunderhub npm install --quiet
if ! [ $? -eq 0 ]; then
echo "FAIL - npm install did not run correctly, aborting"
exit 1
fi
# build nextjs
echo "Building application..."