title: Capistrano + React (create-react-app) + npm - deploy build issue
body: <p>I'm trying to deploy a react application created using create-react-app and am using Capistrano for deployment and Ubuntu server in AWS as a server.</p>
  <p><strong>Versions -</strong>
  Capistrano: 3.15
  React: 17.0.1</p>
  <p>I am getting the below error while deploying into the AWS ec2 ubuntu instance server,</p>
  <pre><code>.
  .
  .
  00:29 npm:install
        01 /tmp/shopping/nvm-exec.sh npm install --silent --no-progress
        01 Now using node v15.5.1 (npm v6.14.11)
        01
        01 audited 2210 packages in 48.746s
        01
        01
        01 3 packages are looking for funding
        01
        01   run `npm fund` for details
        01
        01
        01 found 0 vulnerabilities
        01
        01
      ✔ 01 ubuntu@IP_ADDR 51.633s
  01:21 deploy:npm_deploy
        01  build
        01 /usr/bin/env:
        01 ‘build’
        01 : No such file or directory
        01
   stdout: /usr/bin/env: ‘build’: No such file or directory
   stderr: Nothing written
  (Backtrace restricted to imported tasks)
  cap aborted!
  SSHKit::Runner::ExecuteError: Exception while executing as ubuntu@IP_ADDR:  exit status: 127
   stdout: /usr/bin/env: ‘build’: No such file or directory
   stderr: Nothing written
  
  
  Caused by:
  SSHKit::Command::Failed:  exit status: 127
   stdout: /usr/bin/env: ‘build’: No such file or directory
   stderr: Nothing written
  
  Tasks: TOP =&gt; deploy:symlink:release =&gt; deploy:npm_deploy
  (See full trace by running task with --trace)
  The deploy has failed with an error: Exception while executing as ubuntu@IP_ADDR:  exit status: 127
   stdout: /usr/bin/env: ‘build’: No such file or directory
   stderr: Nothing written
  
  
  ** DEPLOY FAILED
  ** Refer to log/capistrano.log for details. Here are the last 20 lines:
  
  
   DEBUG [6caec9a2]   
  
   DEBUG [6caec9a2]   
  
   DEBUG [6caec9a2]   3 packages are looking for funding
  
   DEBUG [6caec9a2]   
  
   DEBUG [6caec9a2]     run `npm fund` for details
  
   DEBUG [6caec9a2]   
  
   DEBUG [6caec9a2]   
  
   DEBUG [6caec9a2]   found 0 vulnerabilities
  
   DEBUG [6caec9a2]   
  
   DEBUG [6caec9a2]   
  
    INFO [6caec9a2] Finished in 51.633 seconds with exit status 0 (successful).
  
   DEBUG [141e7887] Running if test ! -d ~/projects/shopping/staging/releases/20210125100109; then echo &quot;Directory does not exist '~/projects/shopping/staging/releases/20210125100109'&quot; 1&gt;&amp;2; false; fi as ubuntu@IP_ADDR
  
   DEBUG [141e7887] Command: if test ! -d ~/projects/shopping/staging/releases/20210125100109; then echo &quot;Directory does not exist '~/projects/shopping/staging/releases/20210125100109'&quot; 1&gt;&amp;2; false; fi
  
   DEBUG [141e7887] Finished in 0.602 seconds with exit status 0 (successful).
  
    INFO [7e4d0fd0] Running /usr/bin/env  build as ubuntu@IP_ADDR
  
   DEBUG [7e4d0fd0] Command: cd ~/projects/shopping/staging/releases/20210125100109 &amp;&amp; ( export NODE_VERSION=&quot;v15.5.1&quot; ; /usr/bin/env  build )
  
   DEBUG [7e4d0fd0]   /usr/bin/env: 
  
   DEBUG [7e4d0fd0]   ‘build’
  
   DEBUG [7e4d0fd0]   : No such file or directory
  
   DEBUG [7e4d0fd0] 
  </code></pre>
  <p>Here is my code,</p>
  <p><strong>Gemfile</strong></p>
  <pre><code>source 'https://rubygems.org'
  git_source(:github) {|repo_name| &quot;https://github.com/#{repo_name}&quot; }
  
  group :development do
      gem 'capistrano'
      gem 'capistrano-nvm', require: false
      gem 'capistrano-npm'
  end
  </code></pre>
  <p><strong>Capfile</strong></p>
  <pre><code>require &quot;capistrano/setup&quot;
  require &quot;capistrano/deploy&quot;
  require &quot;capistrano/scm/git&quot;
  install_plugin Capistrano::SCM::Git
  
  require &quot;capistrano/nvm&quot;
  require &quot;capistrano/npm&quot;
  
  Dir.glob(&quot;lib/capistrano/tasks/*.rake&quot;).each { |r| import r }
  </code></pre>
  <p><strong>deploy.rb</strong></p>
  <pre><code>append :linked_files, &quot;.env&quot;
  append :linked_dirs, &quot;node_modules&quot;
  
  set :nvm_type, :user
  set :nvm_node, &quot;v15.5.1&quot;
  set :nvm_map_bins, %w{node npm yarn}
  set :npm_flags, %w{--silent --no-progress}
  
  namespace :deploy do
    task :npm_deploy do
      on roles(:app) do
        within fetch(:npm_target_path, release_path) do
          execute fetch(:npm_bin), &quot;build&quot;
          # execute &quot;react-scripts build&quot;
        end
      end
    end
  
    before &quot;symlink:release&quot;, :npm_deploy
  end
  
  set :keep_releases, 3
  </code></pre>