简体   繁体   中英

rake assets precompile failed

When I run bundle exec rake assets:precompile --trace , my precompilation fails but I cannot see any specific reason for it.

See this pastebin for my output: http://pastebin.com/zggZyPyM

Precompiling assets takes a lot of memory. ~=400mb in my case. It might be possible that OS is killing of the process due to excessive memory usage. You can check the syslog to verify if that is the case.

You can increase the memory of your server to avoid the situation. If that is not possible, I would suggest that you precompile assets on your local system, commit them to the repo and deploy to the server. That way you wouldn't have to compile assets on your server. However you might want to look into ways to delete the previously generated assets somehow and also automate the process.

, but issue was resolvedI tried installing node.js first. And then, ran the following command bundle exec rake assets:precompile . Only then I didn't notice the error.

Initially, I thought it was because of low memory too. Cleaned almost all running applications, but couldn't find a solution. Plus, I opened Ruby as administrator. Not sure if that helped too, but issue was resolved.

This issue can also be resolved by using a node.js JS runtime to precompile assets as it apparently has a lower memory footprint. For Ubunutu 14.04 I needed to run apt-get install nodejs , then replace the default js runtime in the Gemfile with gem 'node' , run bundle and finally rerun the precompile. I would caution against precompiling in another location as you may forget to do this after a css or js change, leading to errors.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM