Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,18 @@ plugindirname=$(basename "$plugindir")
nodeversion=$( node -v );
if [[ $nodeversion != v14* ]]; then
echo "Your version of node needs to be v14, but it is set to be "$nodeversion;
exit 1;
echo "Checking available versions before automatically switching...";

source ~/.nvm/nvm.sh
availablenodeversions=$( nvm ls );
if [[ ${availablenodeversions[*]} =~ v14* ]];
then
echo "v14 found. Switching your current version...";
nvm use 14;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that nvm use only uses the target version while the shell is running. So if you are using a different version of node (say, 18.16) and run node -v after the script stops, you will be shown as still using 18.16.

I think this is okay since the other child node dependencies will be installed while using node 14 in the shell, but I could be wrong...

We could also change the user's default node version to make the change persist.

else
echo "Please install node v14, then run this script again.";
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This installation could probably be automated as well, though we will have to check python dependencies etc as the install might fail for an older version of node with a current version of python installed.

exit 1;
fi
fi

# Install dependencies.
Expand Down