chia-blockchain/start-gui.sh
Kyle Altendorf fc95c638a3
Update to handle the NodeJS 16 dependency (#9921)
* preliminary testing of in-directory n on ubuntu always

* Use more n chiaminejp (#9971)

* Added n as a local npm dependency

* Fixed an issue where `install.sh` always tried to run `sudo apt install bc -y` even if `bc` is installed already

* Added validations and useful outputs for `start-gui.sh`

* Fixed lint error and use shell functions for readability

* Replace tags with spaces

* Skip installing python39 on RH like OS if it is already installed

* Fixed an issue where start-gui.sh failed silently if venv is not activated

* Suppressed message from pacman

* Support CentOS7

* Fixed typo

* Reduced unnecessary install messages

* Fixed end of file

* Added npm_global/__init__.py to pass CI

* Fixed lint errors

* Install python/sqlite from source on AMZN2. Clear old venv when changing python version on install

* Suppress unnecessary command outputs

* Suppress outputs

* Added centos7/8 to install test

* A minor fix

* Fixed yaml syntax error

* Fixed an issue where test-install-scripts failed in CentOS

Co-authored-by: ChiaMineJP <admin@chiamine.jp>
2022-02-11 18:30:19 -08:00

53 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
set -e
export NODE_OPTIONS="--max-old-space-size=3000"
SCRIPT_DIR=$(cd -- "$(dirname -- "$0")"; pwd)
echo "### Checking GUI dependencies"
if [ -d "${SCRIPT_DIR}/.n" ]; then
export N_PREFIX="${SCRIPT_DIR}/.n"
export PATH="${N_PREFIX}/bin:${PATH}"
echo "Loading nodejs/npm from"
echo " ${N_PREFIX}"
fi
if [ -z "$VIRTUAL_ENV" ]; then
echo "This requires the chia python virtual environment."
echo "Execute '. ./activate' before running."
exit 1
fi
if ! npm version >/dev/null 2>&1; then
echo "Please install GUI dependencies by:"
echo " sh install-gui.sh"
echo "on ${SCRIPT_DIR}"
exit 1
fi
NPM_VERSION="$(npm -v | cut -d'.' -f 1)"
if [ "$NPM_VERSION" -lt "7" ]; then
echo "Current npm version($(npm -v)) is less than 7. GUI app requires npm>=7."
exit 1
else
echo "Found npm $(npm -v)"
fi
echo "### Checking GUI build"
GUI_BUILD_PATH="${SCRIPT_DIR}/chia-blockchain-gui/packages/gui/build/electron/main.js"
if [ ! -e "$GUI_BUILD_PATH" ]; then
echo "Error: GUI build was not found"
echo "It is expected at $GUI_BUILD_PATH"
echo "Please build GUI software by:"
echo " sh install-gui.sh"
exit 1
else
echo "Found $GUI_BUILD_PATH"
fi
echo "### Starting GUI"
cd "${SCRIPT_DIR}/chia-blockchain-gui/"
echo "npm run electron"
npm run electron