Open muhammadawais05 opened 1 year ago
That error isn't coming from this gem, it's coming from Rubygems' bundler at this line, where it is trying to unpack the gem file that was downloaded.
It seems to me that the file didn't download successfully, even though the system thought it did.
I would try and re-deploy. It might have been an intermittent issue downloading from the rubygems servers.
If it continues to fail, then it might be something with your deployment setup. One thing that is fairly unique about this gem, is that it is quite large, as far as Ruby gems go. It's about 261MB. Maybe your system doesn't have enough drive space to save it to disk, enough tmp
space or memory to unpack it?
Another thing you might consider is just pulling out the single wkhtmltopdf
binary you need and deploying it vendored in with your code, or by creating an OS-specific internal gem.
Please let me know how it goes, and how you solved your issue!
That error isn't coming from this gem, it's coming from Rubygems' bundler at this line, where it is trying to unpack the gem file that was downloaded.
It seems to me that the file didn't download successfully, even though the system thought it did.
I would try and re-deploy. It might have been an intermittent issue downloading from the rubygems servers.
If it continues to fail, then it might be something with your deployment setup. One thing that is fairly unique about this gem, is that it is quite large, as far as Ruby gems go. It's about 261MB. Maybe your system doesn't have enough drive space to save it to disk, enough
tmp
space or memory to unpack it?Another thing you might consider is just pulling out the single
wkhtmltopdf
binary you need and deploying it vendored in with your code, or by creating an OS-specific internal gem.Please let me know how it goes, and how you solved your issue!
There is an enough space on the server. So I think it is not because of the space. Secondly, one thing I have noticed is when I remove gem 'wkhtmltopdf-binary', '~> 0.12.6.6'
from the gem file then deploy the code on production. It deploys on the server.
error on bundler:install on executing cap production deploy
when gem 'wkhtmltopdf-binary', '~> 0.12.6.6'
is included in the gemfile:
01:58 bundler:install 01 /home/deployer/www/medicolegalreport/rvm1scripts/rvm-auto.sh ruby-3.1.2 bundle install --jobs 4 --quiet 01 Exception while verifying /home/deployer/www/medicolegalreport/shared/bundle/ruby/3.1.0/cache/wkhtmltopdf-binary-0.12.6.6.gem 01 --- ERROR REPORT TEMPLATE ------------------------------------------------------- 01 01 ``` 01 NoMethodError: undefined method
size' for nil:NilClass
01
01 @read += ret.size
01 ^^^^^
01 /usr/local/rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems/package/tar_reader/entry.rb:139:in read' 01 /usr/local/rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems/package.rb:364:in
block in digest'
01 /usr/local/rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems/package.rb:361:in each' 01 /usr/local/rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems/package.rb:361:in
digest'
01 /usr/local/rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems/package.rb:647:in verify_entry' 01 /usr/local/rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems/package.rb:666:in
block in verify_files'
01 /usr/local/rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems/package/tar_reader.rb:65:in each' 01 /usr/local/rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems/package.rb:665:in
verify_files'
01 /usr/local/rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems/package.rb:596:in block (2 levels) in verify' 01 /usr/local/rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems/package/tar_reader.rb:27:in
new'
01 /usr/local/rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems/package.rb:593:in block in verify' 01 /usr/local/rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems/package/file_source.rb:29:in
open'
01 /usr/local/rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems/package/file_source.rb:29:in with_read_io' 01 /usr/local/rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems/package.rb:592:in
verify'
01 /usr/local/rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems/package.rb:573:in spec' 01 /home/deployer/www/medicolegalreport/shared/bundle/ruby/3.1.0/gems/bundler-2.4.16/lib/bundler/rubygems_gem_installer.rb:95:in
spec'
01 /home/deployer/www/medicolegalreport/shared/bundle/ruby/3.1.0/gems/bundler-2.4.16/lib/bundler/source/rubygems.rb:185:in install' 01 /home/deployer/www/medicolegalreport/shared/bundle/ruby/3.1.0/gems/bundler-2.4.16/lib/bundler/installer/gem_installer.rb:54:in
install'
01 /home/deployer/www/medicolegalreport/shared/bundle/ruby/3.1.0/gems/bundler-2.4.16/lib/bundler/installer/gem_installer.rb:16:in install_from_spec' 01 /home/deployer/www/medicolegalreport/shared/bundle/ruby/3.1.0/gems/bundler-2.4.16/lib/bundler/installer/parallel_installer.rb:156:in
do_install'
01 /home/deployer/www/medicolegalreport/shared/bundle/ruby/3.1.0/gems/bundler-2.4.16/lib/bundler/installer/parallel_installer.rb:147:in block in worker_pool' 01 /home/deployer/www/medicolegalreport/shared/bundle/ruby/3.1.0/gems/bundler-2.4.16/lib/bundler/worker.rb:62:in
apply_func'
01 /home/deployer/www/medicolegalreport/shared/bundle/ruby/3.1.0/gems/bundler-2.4.16/lib/bundler/worker.rb:57:in block in process_queue' 01 /home/deployer/www/medicolegalreport/shared/bundle/ruby/3.1.0/gems/bundler-2.4.16/lib/bundler/worker.rb:54:in
loop'
01 /home/deployer/www/medicolegalreport/shared/bundle/ruby/3.1.0/gems/bundler-2.4.16/lib/bundler/worker.rb:54:in process_queue' 01 /home/deployer/www/medicolegalreport/shared/bundle/ruby/3.1.0/gems/bundler-2.4.16/lib/bundler/worker.rb:90:in
block (2 levels) in create_threads'
01
01 01 01 ## Environment 01 01
`
` DEPLOY FAILED Refer to log/capistrano.log for details. Here are the last 20 lines:
tzinfo-data
web-console
wicked_pdf
wkhtmltopdf-binary (~> 0.12.6.6)
RUBY VERSION
ruby 3.1.2p20
BUNDLED WITH
2.4.16
--- TEMPLATE END ----------------------------------------------------------------
DEBUG [1f6883a7] Unfortunately, an unexpected error occurred, and Bundler cannot continue.
DEBUG [1f6883a7]
First, try this link to see if there are any existing issue reports for this error:
https://github.com/rubygems/rubygems/search?q=undefined+method+%60size%27+for+nil+NilClass&type=Issues`
Try running bundle pristine wkhtmltopdf-binary
on the server, or gem uninstall wkhtmltopdf-binary
. Either one should remove any left behind or corrupted files that might be on the system. Then try and bundle install
again.
Even if you have enough disk space, I’ve heard of issues with quotas on temporary space, or timeouts during deploy.
again, you can also browse the bin
dir of this project and just grab the binary for your OS, which is probably only 20mb or so. This gem has a lot of binaries for many different OS’s.
Issue Summary: I encountered an issue while deploying a Rails application using Capistrano. The deployment process fails during the bundler:install task with the following error:
Exception while verifying /path/to/bundle/cache/wkhtmltopdf-binary-0.12.6.6.gem NoMethodError: undefined method `size' for nil:NilClass @read += ret.size
Environment:
Ruby version: 3.1.2 Bundler version: 2.4.22
Steps to Reproduce:
Clone the repository. Run cap production deploy to deploy the Rails application. Expected Behavior: The deployment process should complete successfully without errors.
Actual Behavior: The deployment fails with the mentioned error related to the wkhtmltopdf-binary gem.
Additional Information:
Gemfile content:
Possible Solutions (if any): I have tried different possible solutions found on Google but they did not work.
References:
Note: This issue seems to be specific to the wkhtmltopdf-binary gem during the deployment process. I have checked for existing reports on the RubyGems GitHub repository, and no similar issues were found. I'm creating this issue to seek assistance in resolving the problem.
![Uploading Screenshot 2023-11-17 at 11.56.36 PM.png…]() ![Uploading Screenshot 2023-11-17 at 11.58.08 PM.png…]()