Skip to content

Commit

Permalink
Fix .nvmrc file path (#36)
Browse files Browse the repository at this point in the history
### What was the problem?

This PR resolves LISK-944.

### How was it solved?

File path for `.nvmrc` was fixed when reading this file.
  • Loading branch information
matjazv authored Aug 15, 2024
1 parent 9b5b689 commit e0f8216
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
1 change: 0 additions & 1 deletion scripts/installApplication.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

# Install application
app_dir_name=/home/ubuntu/lisk-across-relayer
mkdir $app_dir_name
cd $app_dir_name
echo "Current DIR: $PWD"
yarn install --frozen-lockfile
Expand Down
26 changes: 17 additions & 9 deletions scripts/installDependencies.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
# Install nodejs dependencies
echo "Current DIR: $PWD"
#!/bin/bash
# Script to install Node.js using NVM on Ubuntu

app_dir_name=/home/ubuntu/lisk-across-relayer
cd $app_dir_name
echo "Current DIR: $PWD"

# Read node version from .nvmrc file
node_version=$(cat .nvmrc | tr -d "\n")
if [[ -z "${node_version-}" ]];
then
echo ".nvmrc not found; exiting..."
exit 1
fi

# Function to install NVM
install_nvm() {
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
}

install_node_version() {
# Setting up environment for NVM
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"

# Check if NVM is installed
export NVM_DIR="$HOME/.nvm"

if [ -s "$NVM_DIR/nvm.sh" ];
then
echo "NVM is already installed."
Expand All @@ -22,19 +31,18 @@ install_node_version() {
install_nvm
fi

# Setting up environment for 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" # This loads nvm

# Load NVM
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

echo "Installing Node version $node_version..."
nvm install $node_version
}

install_node_version

echo "Node.js version $node_version has been installed."

# Install yarn
npm install --global yarn

# Install pm2
npm install --global pm2@latest

0 comments on commit e0f8216

Please sign in to comment.