From efa5418f0b8eca212f1b45c01ef0dc46b7f2bda4 Mon Sep 17 00:00:00 2001 From: AlpinDale <52078762+AlpinDale@users.noreply.github.com> Date: Wed, 19 Apr 2023 00:00:57 +0430 Subject: [PATCH] Create start.sh --- start.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 start.sh diff --git a/start.sh b/start.sh new file mode 100644 index 000000000..911194dc5 --- /dev/null +++ b/start.sh @@ -0,0 +1,25 @@ + +#!/bin/bash + +if ! command -v npm &> /dev/null +then + read -p "npm is not installed. Do you want to install nodejs and npm? (y/n)" choice + case "$choice" in + y|Y ) + echo "Installing nvm..." + export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" + curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash + source ~/.bashrc + nvm install node;; + n|N ) + echo "Nodejs and npm will not be installed." + exit;; + * ) + echo "Invalid option. Nodejs and npm will not be installed." + exit;; + esac +fi + +npm i +node server.js