deployment-dcdn/bin/install_node.sh

22 lines
699 B
Bash

#!/bin/bash
. bin/variables.sh
. bin/functions.sh
touch /var/www/.bashrc
mkdir /var/www/.nvm
mkdir /var/www/.npm
chown -R www-data:www-data /var/www
install_pkg build-essential
su -s /bin/bash -c 'curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash &&\
export NVM_DIR="$HOME/.nvm" &&\
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" &&\
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" &&\
nvm install v18' www-data
ln -sf /var/www/.nvm/versions/node/v18.*/bin/node /usr/bin/node
ln -sf /var/www/.nvm/versions/node/v18.*/bin/npm /usr/bin/npm
ln -sf /var/www/.nvm/versions/node/v18.*/bin/npx /usr/bin/npx
echo -e "${PURPLE}Node installed${RESET}";