Problem with Ruby Gem and Sanitize - ruby

I'm trying to install the Ruby gem sanitize. I've already installed nokogiri:
>gem list nokogiri
*** LOCAL GEMS ***
nokogiri (1.4.0)
but when I try and install sanitize I get the following error:
>gem install rgrove-sanitize
ERROR: Error installing rgrove-sanitize:
rgrove-sanitize requires nokogiri (~> 1.3.3, runtime)

rgrove-sanitize uses the pessimistic operator, which, in this case, means you need a Nokogiri version of 1.3.3 or greater, but less than 1.4 (which is what you have). You need to install the correct version of Nokogiri:
>gem install --version "~> 1.3.3" nokogiri

Related

Install Bundle nokogiri Redmine Error Linux [duplicate]

This question already has answers here:
Error while installing json gem 'mkmf.rb can't find header files for ruby'
(19 answers)
Closed 4 years ago.
I need some help...
I have been following these instructions:
https://www.redmine.org/account/activate?token=2375a89a6b6f6a04b05bc941e93cb3ea82c15a89
I having an issue with this step:
Install dependencies using the Gem bundler¶
This step will look at the dependencies specified in the Gemfile:
% cd /var/www/redmine
% bundle install
When I run the command, I get this error:
[fit54#u ~]$ cd /var/www/redmine
[fit54#u redmine]$ bundle install
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x64-mingw32, x86-mswin32. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x64-mingw32 x86-mswin32`.
/usr/share/gems/gems/psych-2.0.0/lib/psych.rb:98: warning: already initialized constant Psych::VERSION
/usr/share/ruby/psych.rb:98: warning: previous definition of VERSION was here
/usr/share/gems/gems/psych-2.0.0/lib/psych.rb:101: warning: already initialized constant Psych::LIBYAML_VERSION
/usr/share/ruby/psych.rb:101: warning: previous definition of LIBYAML_VERSION was here
Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies....
Using rake 12.3.1
Using i18n 0.7.0
Using minitest 5.11.3
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using activesupport 4.2.8
Using builder 3.2.3
Using erubis 2.7.0
Using mini_portile2 2.1.0
Fetching nokogiri 1.6.8.1
Installing nokogiri 1.6.8.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/fit54/.gem/ruby/gems/nokogiri-1.6.8.1/ext/nokogiri
/usr/bin/ruby -r ./siteconf20180406-9964-oibzlr.rb extconf.rb
--use-system-libraries
mkmf.rb can't find header files for ruby at /usr/share/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /home/fit54/.gem/ruby/gems/nokogiri-1.6.8.1
for inspection.
Results logged to
/home/fit54/.gem/ruby/extensions/x86_64-linux/nokogiri-1.6.8.1/gem_make.out
An error occurred while installing nokogiri (1.6.8.1), and Bundler
cannot continue.
Make sure that `gem install nokogiri -v '1.6.8.1'` succeeds before bundling.
In Gemfile:
rails was resolved to 4.2.8, which depends on
actionmailer was resolved to 4.2.8, which depends on
actionpack was resolved to 4.2.8, which depends on
actionview was resolved to 4.2.8, which depends on
rails-dom-testing was resolved to 1.0.9, which depends on
nokogiri
Please let me know what other information I need to provide or what help can be given to me to help resolve this issue.
sudo apt-get install ruby`ruby -e 'puts RUBY_VERSION[/\d+\.\d+/]'`-dev
There is no ruby dev environment which is why native extensions cannot be built. Give the above command a try- it should fix the issue.

Jekyll install with Ruby 2.5

I got a problem when i was installing Jekyll on win10.
When I finished deployment for ruby and wanna install Jekyll, it needs to install bundle first.
Fetching ffi 1.9.17 (x64-mingw32)
Installing ffi 1.9.17 (x64-mingw32)
Gem::RuntimeRequirementNotMetError: ffi requires Ruby version < 2.5, >= 2.0. The
current ruby version is 2.5.0.
An error occurred while installing ffi (1.9.17), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.9.17'` succeeds before bundling.
Then I followed the instruction
gem install ffi -v 1.9.17
The Error log is
ERROR: Error installing ffi:
The last version of ffi (= 1.9.17) to support your Ruby & RubyGems was 1.9.17. Try installing it with `gem install ffi -v 1.9.17`
ffi requires Ruby version < 2.5, >= 2.0. The current ruby version is 2.5.0.
Also I have tried to followed the solution by vbortone.
gem install ffi -f
It also didn't work.
ERROR: Error installing ffi:
The last version of ffi (= 1.9.17) to support your Ruby & RubyGems was 1.9.17. Try installing it with `gem install ffi -v 1.9.17`
ffi requires Ruby version < 2.5, >= 2.0. The current ruby version is 2.5.0.
The recent versions of ffi installs fine on Ruby 2.5. Bundler automatically requests for the latest version, unless there's a Gemfile.lock file, or a constraint has been specified in a Gemfile file or a dependency's gemspec.
You can first try running bundle update.
If that doesn't work, you can edit the Gemfile file (if available), and add gem 'ffi', '~> 1.9' before running bundle install. You can also manually install the gem with gem install ffi.

InstallError: nokogiri requires Ruby version >= 2.1.0

My current rails application has been built on ruby 1.9.3 and rails 3. I am doing bundle install one of the rails engines and I am received following error
Gem::InstallError: nokogiri requires Ruby version >= 2.1.0.
An error occurred while installing nokogiri (1.8.2), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.8.2'` succeeds before bundling.
How I can get rid of this issue without updating ruby version.
You need to install the compatible version of nokogiri with ruby version 1.9.3
gem 'nokogiri', '~> 1.6', '>= 1.6.8.1' in your Gemfile.
But note, that Ruby versions below 2.1 are no longer maintained and no longer supported by nokogiri.
hope it will help you out

Missing gem Faraday

I'm new to Ruby and I'm just trying to run a script. Firstly, when I try to bundle install it says:
Daniels-Air:Documents Daniel$ bundle install
Fetching gem metadata from https://rubygems.org/........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies...
Rubygems 2.0.3 is not threadsafe, so your gems will be installed one at a time. Upgrade to Rubygems 2.1.0 or higher to enable parallel gem installation.
Installing ffi 1.9.10 with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/include/ruby.h
Gem files will remain installed in /var/folders/_r/8pxmrph95fj0km8h7sfkw9f40000gn/T/bundler20151216-21689-8jiqebffi-1.9.10/gems/ffi-1.9.10 for inspection.
Results logged to /var/folders/_r/8pxmrph95fj0km8h7sfkw9f40000gn/T/bundler20151216-21689-8jiqebffi-1.9.10/gems/ffi-1.9.10/ext/ffi_c/gem_make.out
Using multipart-post 2.0.0
Installing json 1.8.3 with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/include/ruby.h
Gem files will remain installed in /var/folders/_r/8pxmrph95fj0km8h7sfkw9f40000gn/T/bundler20151216-21689-5mz4k9json-1.8.3/gems/json-1.8.3 for inspection.
Results logged to /var/folders/_r/8pxmrph95fj0km8h7sfkw9f40000gn/T/bundler20151216-21689-5mz4k9json-1.8.3/gems/json-1.8.3/ext/json/ext/generator/gem_make.out
Using multi_json 1.11.2
Using rubyzip 1.1.7
Using websocket 1.2.2
Using bundler 1.11.1
An error occurred while installing ffi (1.9.10), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.9.10'` succeeds before bundling.
When I then try to execute the file anyway I come across the problem:
Could not find gem 'faraday' in any of the gem sources listed in your Gemfile or available on this machine.
Run `bundle install` to install missing gems.
Where do I get this 'faraday' gem from? Should it have come with the code I am trying to run, or should I update something? Sorry if I got some terminology wrong, I'm very new to Ruby.
I've just realised all I needed to do was install the gem. Its made clear from the RubyGems.org library. Just typed:
sudo gem install faraday
to the terminal

Ruby yob pdf reader, wrong argument quantity

I'm trying to install the yob pdf reader: https://github.com/yob/pdf-reader#readme
My script has the following code:
reader = PDF::Reader.new("1.pdf")
when I run that script I get the following error:
`initialize': wrong number of arguments (1 for 0) (ArgumentError)
Which doesn't make any sense because the directions say this should be done this way.
How do I solve this?
p.s.
gem list command produces:
*** LOCAL GEMS ***
Ascii85 (1.0.1)
bundler (1.0.18)
columnize (0.3.4)
linecache (0.46)
nokogiri (1.5.0)
pdf-reader (0.10.0)
rbx-require-relative (0.0.5)
rdoc (3.9.4, 2.5.11)
rdoc-data (2.5.3)
ruby-debug (0.10.4)
ruby-debug-base (0.10.4)
rudebug (0.3.2)
syntax (1.0.0)
gem -v produces: 1.3.7
You most likely have a gem version conflict. You can specify the version of the gem that you want to require, in case you have multiple versions installed:
require 'rubygems'
gem 'pdf-reader', "~> 0.10.0"
require 'pdf-reader'
Update
I would slap myself if I could. There's nothing wrong with your setup. The instructions to use PDF::Reader.new "my_file.pdf" are for the git version.
Check the examples directory for the version 0.10.0 to get examples of how to use the library.

Resources