Issue getting wkhtmltoimage working on Amazon Linux / Ruby on Rails - amazon-ec2

It works fine on my development environment (osx), but I can't get it to work on the server.
in my gemfile
gem 'imgkit'
gem 'wkhtmltoimage-binary'
When I run:
kit = IMGKit.new(html, quality: 100)
img_binary = kit.to_img
I get this error
IMGKit::CommandFailedError: Command failed:
/var/www/myapp/shared/bundle/ruby/2.3.0/bin/wkhtmltoimage --height 0 --quality 100 --format jpg - -:
/var/www/myapp/shared/bundle/ruby/2.3.0/gems/wkhtmltoimage-binary-0.12.5/libexec/wkhtmltoimage-amd64:
error while loading shared libraries: libjpeg.so.8: cannot open shared object file: No such file or directory
I've searched online and tried installing some more packages, but no success. Anyone able to help? Thanks.

Using 'wkhtmltoimage-binary', '~> 0.11.0.1.1' in the Gemfile fixed the issue for me. Found the solution here.

Related

Ruby on Rail running apache show index of when accessing the site

I have recently updated to Apache 2.4, and I am using Ruby on Rail to run my application. Following the upgrade, the site shows a content as seen in the image below, and the error on the log file shows this error message. I have tried using the 'Bundle Install' and checked the permission but that hasn't helped. Any advice would be greatly appreciated. Thanks
[ 2022-02-07 07:47:24.5559 8104/7efc89c8f700 age/Cor/App/Implementation.cpp:304 ]: Could not spawn process for application /home/adminuser/hroot: An error occured while starting up the preloader.
Error ID: ba7e6074
Error details saved to: /tmp/passenger-error-RA01E9.html
Message from application: libmysqlclient.so.18: cannot open shared object file: No such file or directory - /usr/local/rvm/gems/ruby-2.0.0-p353#hroot/gems/mysql2-0.3.14/lib/mysql2/mysql2.so (LoadError)
PassengerRuby /usr/local/rvm/gems/ruby-2.0.0-p353#hroot/wrappers/ruby
SetEnv GEM_HOME /root/.gem/ruby/1.9.1
This error shows a problem with the shared objects. You probably updated MySQL/MariaDB libraries with Apache and new libraries are incompatible with your mysql2 gem build. The solution is simple:
First, ensure you are using the ruby-2.0.0-p353#hroot RVM environment.
Then, execute the following command:
gem install mysql2 --version 0.3.14
This should rebuild your mysql2 gem for the new MySQL/MariaDB client libraries on your system.
this isn't the answer anyway but another method to run ruby (in my case Windows 10 ; if you use another OS try to find out how to modify inside index.php the ruby starter)
i post here an alternative method to use apache + php +... and ruby
https://stackoverflow.com/a/71733656/5781320

electron-forge --template=typescript-webpack cannot compile sqlite3

Using a package that leverages sqlite3. It looks like sqlite3 is not being recompiled properly. searched around and saw people recommending better-sqlite3. This would require me to have to port the sqlite3 code (no db.serialize equivalent). Is there another way to get sqlite3 working?
❯ yarn start
...
App threw an error during load
Error: Cannot open [redacted]/node_modules/sqlite3/lib/binding/node-v83-darwin-x64/node_sqlite3.node: Error: The module '[redacted]/node_modules/sqlite3/lib/binding/node-v83-darwin-x64/node_sqlite3.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 83. This version of Node.js requires
NODE_MODULE_VERSION 80. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
...
ERROR in ./node_modules/node-pre-gyp/lib/node-pre-gyp.js
Module not found: Error: Can't resolve './' in '[redacted]/node_modules/node-pre-gyp/lib'
# ./node_modules/node-pre-gyp/lib/node-pre-gyp.js 52:13-32 184:38-57
# ./node_modules/sqlite3/lib/sqlite3-binding.js
# ./node_modules/sqlite3/lib/sqlite3.js
# ./node_modules/chrome-cookies-secure/index.js
Not a great answer but electron-react-boilerplate supports it by adding sqlite into the /app/package.json.

Jekyll serve error - jekyll 3.2.1 Error: File exists # syserr_fail2_in

I'm attempting to migrate a Jekyll site over to my local machine and was doing ok but I've run into an error I am struggling to find much information regarding. I am pretty new to the whole Jekyll thing so any help is much appreciated.
When I run bundle exec jekyll serve I get the following error:
$ bundle exec jekyll serve
Configuration file: /home/Documents/devsite/websites/marketing/_config.yml
Source: /home/Documents/devsite/websites/marketing
Destination: /home/Documents/devsite/websites/marketing/_site
Incremental build: disabled. Enable with --incremental
Generating...
Building site for default language: "en-gb" to: /home/Documents/devsite/websites/marketing/_site
jekyll 3.2.1 | Error: File exists # syserr_fail2_in - /home/Documents/devsite/websites/marketing/_site/favicon.ico
I'm unsure as to what this error relates to so I'm a little unsure as to where to go next. Thanks for any help.

Error -60005 when install Cocos2d-iPhone v3 RC4

When I try to install Cocos2d-iphone 3.0.0 RC4, I got an error: (run without sudo)
Error -60005 occurred while executing script with privileges.
So, I try to show its package content and use terminal to do: cd ...Cocos2D Installer 3.0.0.app/Contents/MacOS
I try this command: (with sudo)
sudo ./Cocos2D\ Installer\ 3.0.0
It works but I got log with some errors:
[1m>>> Installing Cocos2D-v3.0.0 files (B[m
[1m>>> Installing Cocos2D-v3.0.0 templates (B[m
[4m[1mCocos2D Template Installer (Cocos2D-v3.0.0)(B[m
Error: [31m✖︎(B[m Script cannot be executed as root.
In order for it to work properly, please execute the script again without 'sudo'.
If you want to know more about how to use this script execute '/Users/viethung/Downloads/Cocos2D-v3.0.0/install.sh --help'.
[1m>>> Building/Installing Cocos2D-v3.0.0 documentation, this may take a minute.... (B[m
appledoc version: 2.2 (build 963)
Generation step 4/5 failed: GBDocSetInstallGenerator failed generating output, aborting!
Documentation set was installed, but couldn't reload documentation within Xcode.
Xcode got an error: No documentation set present at specified path.
[1m>>> Cocos2D-v3.0.0 installation complete! (B[m
Are there any way is better than this way?
I have same problem.
I think you installed old cocos2d-iphone and it caused this problem.
You should remove old cocos2d-iphone first. I removed:
~/Library/Developer/Xcode/cocos2d v3.x
And install again. It works for me.
Hope it works for you :)

Wrong JPEG library - ruby on rails- OS X

I keep getting this error any time i call any page that has a call that uses RMagick, but i can't figure out what library i'm missing, or what i need to install to get rid of this error. Does anyone have debugging suggestions?
Processing SimpleCaptchaController#simple_captcha (for 127.0.0.1 at 2010-01-14 14:24:24) [GET]
Parameters: {"image_style"=>"", "time"=>"1263500664", "simple_captcha_key"=>"13eec13214d2ce84b725d14c5877fcbe13308cf5", "distortion"=>""}
Could not dump header data for exception: not opened for reading
ArgumentError (unknown format: JPG):
/usr/local/lib/ruby/gems/1.8/gems/fiveruns-dash-ruby-0.8.10/lib/fiveruns/dash/instrument.rb:125:in `perform_action_without_rescue'
...
After re-installing based on this cache of the bellow attempted solution
i am getting this error:
Magick::ImageMagickError (Wrong JPEG library version: library is 62, caller expects 70 `' # jpeg.c/EmitMessage/232):
I had to:
sudo port uninstall jpeg
install image magic using this script on git:
http://github.com/masterkain/ImageMagick-sl
after i was able to install rmagick:
sudo gem install rmagick
now, no more problems.
Their site is down at the moment, but when it comes back online you should run this install script by Solomon White.
http://onrails.org/articles/2009/09/04/rmagick-from-source-on-snow-leopard

Resources