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

deployment failed at assets:precompile using capistrano gem #3254

Closed
NehaPeer opened this issue Jan 4, 2022 · 7 comments
Closed

deployment failed at assets:precompile using capistrano gem #3254

NehaPeer opened this issue Jan 4, 2022 · 7 comments

Comments

@NehaPeer
Copy link

NehaPeer commented Jan 4, 2022

Hello

We are using ruby 2.7.3 and Rails 6.1.3.2 while deploying the application using Capistrano gem it throws below error -

INFO [4158d929] Running ~/.rvm/bin/rvm ruby-2.7.3@app-6 do bundle exec rake assets:precompile on carbonite
DEBUG [4158d929] Command: cd /export/app/app_production/releases/20220103125501 && ( export RAILS_ENV="production" RAILS_GROUPS="" ; ~/.rvm/bin/rvm ruby-2.7.3@app-6 do bundle exec rake assets:precompile )
DEBUG [4158d929] Yarn executable was not detected in the system
Download Yarn at https://yarnpkg.com/en/docs/install
DEBUG [4158d929] Yarn executable was not detected in the system
Download Yarn at https://yarnpkg.com/en/docs/install
DEBUG [4158d929] /export/app/app_production/shared/bundle/ruby/2.7.0/gems/sassc-2.4.0/lib/sassc/engine.rb:43: [BUG] Segmentation fault at 0x0000000000000000

Here are the versions of yarn, node, and npm on server:

yarn -v 1.22.17
npm -v 6.14.15
node -v v14.18.2

Even yarn is installed globally.

yarn global list
yarn global v1.22.17
Done in 0.05s.
@NehaPeer NehaPeer changed the title deployment failed at assets:precompile deployment failed at assets:precompile using capistrano gem Jan 4, 2022
@guillaumebriday
Copy link
Member

Did you setup your PATH correctly?

@NehaPeer
Copy link
Author

NehaPeer commented Jan 4, 2022

Did you setup your PATH correctly?

How to set that PATH variable?

@frullah
Copy link

frullah commented Jan 4, 2022

Hello, you can add directory of yarn executable into :default_env config in config/deploy.rb file.
e.g:

# config/deploy.rb

...
set :default_env, {
  path: "$HOME/nodejs/bin:$PATH" # this will add "$HOME/nodejs/bin" into PATH environment variable during Capistrano command execution
}
...

You can read the docs here

@NehaPeer
Copy link
Author

NehaPeer commented Jan 4, 2022

Hello,

On our deployment device, we have a yarn path as per below so we have added it into config/deploy.rb

Deployment device -

which yarn
/export/app/.nvm/versions/node/v14.18.2/bin/yarn

Development device -

config/deploy.rb

set :default_env, {
PATH: '$HOME/.nvm/versions/node/v14.18.2/bin/:$PATH'
}

but it throws the same error -

/export/user/app/shared/bundle/ruby/2.7.0/gems/sassc-2.4.0/lib/sassc/engine.rb:43: [BUG] Segmentation fault at 0x0000000000000000

DEBUG [d123fc23] bash: line 1: 456266 Aborted (core dumped) ~/.rvm/bin/rvm ruby-2.7.3@app do bundle exec rake assets:precompile

@frullah
Copy link

frullah commented Jan 4, 2022

I think the problem comes from sassc gem, i found the same error in sass/sassc-ruby#197.

I found the workaround at sass/sassc-ruby#197 (comment) by adding the code below into config/initializers/assets.rb

Rails.application.config.assets.configure do |env|
  env.export_concurrent = false
end

@NehaPeer
Copy link
Author

NehaPeer commented Jan 4, 2022

@frullah Thank you so much above solution is work for me.

@frullah
Copy link

frullah commented Jan 4, 2022

@NehaPeer It was my pleasure :)

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

4 participants