ruby-on-railsdeploymentcapistranoyarn-v2

Capistrano gem. Compiling error. SSHKit::Command::Failed: rake exit status: 1


I'm attempting to deploy my project. Had no issues before but I'm suddenly getting the following error on compiling step.

00:10 deploy:assets:precompile
      01 /usr/local/rvm/bin/rvm default do bundle exec rake assets:precompile

      01 
      01 yarn install v1.22.5

      01 [1/4] Resolving packages...
      01 
log writing failed. "\xE2" from ASCII-8BIT to UTF-8
      01 ⠁ 

      01 

      01 
      01 [2/4] Fetching packages...
      01
info fsevents@2.3.2: The platform "linux" is incompatible with this module.
info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@1.2.13: The platform "linux" is incompatible with this module.

info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...

      01 warning " > @stripe/react-stripe-js@1.4.0" has incorrect peer dependency "react@^16.8.0 || ^17.0.0".

      01 warning " > @stripe/react-stripe-js@1.4.0" has incorrect peer dependency "react-dom@^16.8.0 || ^17.0.0".

      01 warning " > react-daterange-picker@2.0.1" has incorrect peer dependency "moment-range@^3.0.3".

      01 
      01 warning " > react-daterange-picker@2.0.1" has incorrect peer dependency "react@0.14.x || 15.x.x || 16.x.x".
warning " > react-daterange-picker@2.0.1" has incorrect peer dependency "react-dom@0.14.x || 15.x.x || 16.x.x".
warning " > react-day-picker@7.4.8" has incorrect peer dependency "react@~0.13.x || ~0.14.x || ^15.0.0 || ^16.0.0".
warning "react-router-dom > react-router > mini-create-react-context@0.4.1" has incorrect peer dependency "react@^0.14.0 || ^15.0.0 || ^16.0.0 || ^17…
[4/4] Building fresh packages...

      01 
      01 Done in 9.94s.
      01 Compiling...
      01 Compilation failed:
      01 events.js:174
      01       throw er; // Unhandled 'error' event
      01       ^
      01
      01 Error: write EPIPE
      01     at ChildProcess.target._send (internal/child_process.js:762:20)
      01     at ChildProcess.target.send (internal/child_process.js:634:19)
      01     at ChildProcessWorker.send (/var/www/vhosts/admired-leadership/releases/20230124214219/node_modules/jest-worker/build/workers/ChildProcessWorker.js:291:1…
      01     at WorkerPool.send (/var/www/vhosts/admired-leadership/releases/20230124214219/node_modules/jest-worker/build/WorkerPool.js:32:34)
      01     at Farm._process (/var/www/vhosts/admired-leadership/releases/20230124214219/node_modules/jest-worker/build/Farm.js:129:10)
      01     at Farm._enqueue (/var/www/vhosts/admired-leadership/releases/20230124214219/node_modules/jest-worker/build/Farm.js:152:10)
      01     at Farm._push (/var/www/vhosts/admired-leadership/releases/20230124214219/node_modules/jest-worker/build/Farm.js:159:12)
      01     at Promise (/var/www/vhosts/admired-leadership/releases/20230124214219/node_modules/jest-worker/build/Farm.js:90:14)
      01     at new Promise (<anonymous>)
      01     at Farm.doWork (/var/www/vhosts/admired-leadership/releases/20230124214219/node_modules/jest-worker/build/Farm.js:56:12)
      01     at JestWorker._callFunctionWithArgs (/var/www/vhosts/admired-leadership/releases/20230124214219/node_modules/jest-worker/build/index.js:143:23)
      01     at TaskRunner.runTask (/var/www/vhosts/admired-leadership/releases/20230124214219/node_modules/@rails/webpacker/node_modules/terser-webpack-plugin/dist/T…
      01     at enqueue (/var/www/vhosts/admired-leadership/releases/20230124214219/node_modules/@rails/webpacker/node_modules/terser-webpack-plugin/dist/TaskRunner.j…
      01     at cache.get.then (/var/www/vhosts/admired-leadership/releases/20230124214219/node_modules/@rails/webpacker/node_modules/terser-webpack-plugin/dist/TaskR…
      01 Emitted 'error' event at:
      01     at process.nextTick (internal/child_process.js:766:39)
      01     at process._tickCallback (internal/process/next_tick.js:61:11)
      01
#<Thread:0x00000001312c51c8@/Users/jaepark/.rvm/gems/ruby-2.6.6/gems/sshkit-1.19.1/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
        13: from /Users/jaepark/.rvm/gems/ruby-2.6.6/gems/sshkit-1.19.1/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
        12: from /Users/jaepark/.rvm/gems/ruby-2.6.6/gems/sshkit-1.19.1/lib/sshkit/backends/abstract.rb:31:in `run'
        11: from /Users/jaepark/.rvm/gems/ruby-2.6.6/gems/sshkit-1.19.1/lib/sshkit/backends/abstract.rb:31:in `instance_exec'
        10: from /Users/jaepark/.rvm/gems/ruby-2.6.6/gems/capistrano-rails-1.4.0/lib/capistrano/tasks/assets.rake:67:in `block (4 levels) in <top (required)>'
         9: from /Users/jaepark/.rvm/gems/ruby-2.6.6/gems/sshkit-1.19.1/lib/sshkit/backends/abstract.rb:92:in `within'
         8: from /Users/jaepark/.rvm/gems/ruby-2.6.6/gems/capistrano-rails-1.4.0/lib/capistrano/tasks/assets.rake:68:in `block (5 levels) in <top (required)>'
         7: from /Users/jaepark/.rvm/gems/ruby-2.6.6/gems/sshkit-1.19.1/lib/sshkit/backends/abstract.rb:100:in `with'
         6: from /Users/jaepark/.rvm/gems/ruby-2.6.6/gems/capistrano-rails-1.4.0/lib/capistrano/tasks/assets.rake:69:in `block (6 levels) in <top (required)>'
         5: from /Users/jaepark/.rvm/gems/ruby-2.6.6/gems/sshkit-1.19.1/lib/sshkit/backends/abstract.rb:80:in `execute'
         4: from /Users/jaepark/.rvm/gems/ruby-2.6.6/gems/sshkit-1.19.1/lib/sshkit/backends/abstract.rb:148:in `create_command_and_execute'
         3: from /Users/jaepark/.rvm/gems/ruby-2.6.6/gems/sshkit-1.19.1/lib/sshkit/backends/abstract.rb:148:in `tap'
         2: from /Users/jaepark/.rvm/gems/ruby-2.6.6/gems/sshkit-1.19.1/lib/sshkit/backends/abstract.rb:148:in `block in create_command_and_execute'
         1: from /Users/jaepark/.rvm/gems/ruby-2.6.6/gems/sshkit-1.19.1/lib/sshkit/backends/netssh.rb:169:in `execute_command'
/Users/jaepark/.rvm/gems/ruby-2.6.6/gems/sshkit-1.19.1/lib/sshkit/command.rb:97:in `exit_status=': rake exit status: 1 (SSHKit::Command::Failed)
yarn install v1.22.5

I've tried RAILS_ENV=production bundle exec rake assets:precompile and it compiles no problem locally. From researching I bit, I found Error: write EPIPE might be related to memory leak. But I guess I can't understand why this is happening all of the sudden. May be helpful to know local yarn version is 1.22.19 and remote server yarn version is 1.22.5.


Solution

  • I was getting this error due to not enough memory on the remote system where the site was being deployed to. In this case, digitalocean. I resolved this issue by adding swap space to help handle the deployment process.