FreeDATA/tools/create_node_env.sh
2024-04-18 11:04:25 +02:00

34 lines
652 B
Bash
Executable file

#!/usr/bin/env bash
if [ ! -d "gui" ]; then
echo "Error: Run this script from the main FreeDATA directory."
exit 1
fi
# Move into freedata_gui directory
cd freedata_gui
# Common variables
OLDPATH=${PATH}
PATH=/usr/bin:/bin:/usr/local/bin
NPM=$(which npm)
PATH=${OLDPATH}
VENVDIR="$(pwd)/node_modules"
PATH_ADDITIONS="$(pwd)/node_modules/bin:$(pwd)/node_modules/.bin"
# Verify NPM exists.
if [ -z "${NPM}" ] || [ ! -x "${NPM}" ]; then
echo "Error: ${NPM} isn't executable or doesn't exist."
exit 1
fi
${NPM} install n
${NPM} i
PATH=${PATH_ADDITIONS}:${PATH}
n stable
echo ""
echo "Be sure to add '$PATH_ADDITIONS' to your path."