Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running "mina deploy" failed when "Precompiling asset files", without any detailed error info #658

Closed
ChrisZou opened this issue Jan 5, 2020 · 3 comments

Comments

@ChrisZou
Copy link

ChrisZou commented Jan 5, 2020

Hi, I ran into an error without any detail info when running mina deploy:

-----> Precompiling asset files
 !     ERROR: Deploy failed.
-----> Cleaning up build
       Unlinking current
       OK
       Connection to myserver.com closed.

 !     Run Error

My config/deploy.rb content:

# frozen_string_literal: true

require 'mina/rails'
require 'mina/git'
require 'mina/rvm'    # for rvm support. (https://rvm.io)

set :application_name, 'myapp'
set :domain, 'mydomain.com
set :deploy_to, '/var/www/myapp'
set :repository, 'git@myrepo.git'
set :branch, 'master'

# Shared dirs and files will be symlinked into the app-folder by the 'deploy:link_shared_paths' step.
# Some plugins already add folders to shared_dirs like `mina/rails` add `public/assets`, `vendor/bundle` and many more
# run `mina -d` to see all folders and files already included in `shared_dirs` and `shared_files`
# set :shared_dirs, fetch(:shared_dirs, []).push('public/assets')
 set :shared_files, fetch(:shared_files, []).push('config/database.yml', 'config/master.key')

# This task is the environment that is loaded for all remote run commands, such as
# `mina deploy` or `mina rake`.
task :remote_environment do
  # For those using RVM, use this to load an RVM version@gemset.
   invoke :'rvm:use', 'ruby-2.7.0'
end

# Put any custom commands you need to run at setup
# All paths in `shared_dirs` and `shared_paths` will be created on their own.
task :setup do
  # command %{rbenv install 2.3.0 --skip-existing}
end

desc 'Deploys the current version to the server.'
task :deploy do
  # uncomment this line to make sure you pushed your local branch to the remote origin
  invoke :'git:ensure_pushed'
  deploy do
    # Put things that will set up an empty directory into a fully set-up
    # instance of your project.
    invoke :'git:clone'
    invoke :'deploy:link_shared_paths'
    invoke :'bundle:install'
    invoke :'rails:db_migrate'
    invoke :'rails:assets_precompile'
    invoke :'deploy:cleanup'

    on :launch do
      in_path(fetch(:current_path)) do
        command %(mkdir -p tmp/)
        command %(touch tmp/restart.txt)
      end
    end
  end

end

The previous steps(bundle installing, db migration) seem to be working fine.

My env:
Ruby 2.7.0
Rails 6.0.2.1
Ubuntu 18.04

Any idea why and how to fix it?

@ChrisZou ChrisZou changed the title mina deploy failed without any detail info Running "mina deploy" failed when "Precompiling asset files", without any detailed error info Jan 5, 2020
@karandocs
Copy link

I'm facing the same issue. Any update on this?

@mstr03
Copy link

mstr03 commented Oct 31, 2020

I had the same problem and in my case I did 2 things:

  1. I've changed manifest.js file in app/assets/config which now contain only this one line:
//= link_tree .
  1. I've added command "RAILS_ENV=#{fetch(:rails_env)} bundle exec rails webpacker:yarn_install" before I invoke rails:assets_precompile in deploy.rb

With this 2 things precompiling assets with mina works as intended 🙂

@ChrisZou
Copy link
Author

ChrisZou commented Nov 1, 2020

I think I later found out the cause of the issue. It was that the yarn command was not in my ssh PATH, since I installed yarn using linuxbrew and it was not in the default PATH of a ssh connection. Add /the/path/of/my/linuxbrew/bin to PATH and it should be working all right.

@ChrisZou ChrisZou closed this as completed Nov 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants