cloudron-support: add node version check
This commit is contained in:
@@ -199,6 +199,22 @@ function check_nginx() {
|
||||
success "nginx is running"
|
||||
}
|
||||
|
||||
function check_node() {
|
||||
expected_node_version="$(sed -ne 's/readonly node_version=\(.*\)/\1/p' /home/yellowtent/box/scripts/installer.sh)"
|
||||
current_node_version="$(node --version | tr -d '\n' | cut -c2-)" # strip trailing newline and 'v' prefix
|
||||
|
||||
if [[ "${current_node_version}" != "${expected_node_version}" ]]; then
|
||||
fail "node version is incorrect. Expecting ${expected_node_version}. Got ${current_node_version}."
|
||||
echo "You can try the following to fix the problem:"
|
||||
echo " ln -sf /usr/local/node-${expected_node_version}/bin/node /usr/bin/node"
|
||||
echo " ln -sf /usr/local/node-${expected_node_version}/bin/npm /usr/bin/npm"
|
||||
echo " systemctl restart box"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
success "node version is correct"
|
||||
}
|
||||
|
||||
function check_docker() {
|
||||
if ! systemctl is-active -q docker; then
|
||||
info "Docker is down. Trying to restart docker ..."
|
||||
@@ -282,9 +298,10 @@ EOF
|
||||
|
||||
function troubleshoot() {
|
||||
# note: disk space test has already been run globally
|
||||
check_nginx
|
||||
check_node
|
||||
check_docker
|
||||
check_host_mysql
|
||||
check_nginx # requires mysql to be checked
|
||||
check_box
|
||||
check_unbound
|
||||
check_hairpin_nat # requires mysql to be checked
|
||||
|
||||
Reference in New Issue
Block a user