From 40db2f6999da9679a69019b3b343e6851d0c7dbf Mon Sep 17 00:00:00 2001 From: Eric O Date: Wed, 20 Dec 2023 14:53:48 -0500 Subject: [PATCH] Add NVM/node setup for deploy.rb --- config/deploy.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/config/deploy.rb b/config/deploy.rb index fef3bbb1b..a25f2b6c5 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -45,6 +45,17 @@ # Set default log level (which can be overridden by other environments) set :log_level, :info +# NVM Setup, for selecting the correct node version +# NOTE: This NVM configuration MUST be configured before the RVM setup steps because: +# This works: +# nvm exec 16 ~/.rvm-alma8/bin/rvm example_app_dev do node --version +# But this does not work: +# ~/.rvm-alma8/bin/rvm example_app_dev do nvm exec 16 node --version +set :nvm_node_version, fetch(:deploy_name) # This NVM alias must exist on the server +[:rake, :node, :npm, :yarn].each do |command_to_prefix| + SSHKit.config.command_map.prefix[command_to_prefix].push("nvm exec #{fetch(:nvm_node_version)}") +end + # RVM Setup, for selecting the correct ruby version (instead of capistrano-rvm gem) set :rvm_ruby_version, fetch(:deploy_name) # This RVM alias must exist on the server [:rake, :gem, :bundle, :ruby].each do |command_to_prefix|