What's wrong with this Ruby dependency? - ruby

I am trying to use source2swagger on OSX 10.7.5
It depends on "json" so I am installing that, then trying to run as below.
machine:source2swagger jpbeuc1$ sudo gem install json
Password:
Building native extensions. This could take a while...
Successfully installed json-1.7.7
1 gem installed
Installing ri documentation for json-1.7.7...
Installing RDoc documentation for json-1.7.7...
machine:source2swagger jpbeuc1$ bin/source2swagger
bin/source2swagger:4:in `require': no such file to load -- json (LoadError)
from bin/source2swagger:4
Can anyone tell me what's not working here and how to make source2swagger see "json"?

You have source2swagger installed in your local and gems are installed in root. So your source2swagger which needs json can't access those gem which are installed in root. So I recommend to gems in local always and avoid using sudo for installing gems. To manage gems in local I suggest to use RVM.

Related

Can't install Ruby Compass on Mac Big Sur 11.5.2

I'm trying to get Compass installed on a 2020 Mac Book Pro running Big Sur (11.5.2).
When I try and run:
gem install compass
I get the error:
You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory
If I try and run:
sudo gem install compass
I get the error:
ERROR: Error installing compass:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/ext/ffi_c
I've tried installing and updating Ruby.
I've tried updating the system Ruby, but the system doesn't allow a more recent version than the below:
Updating rubygems-update
Fetching rubygems-update-3.3.3.gem
Successfully installed rubygems-update-3.3.3
Parsing documentation for rubygems-update-3.3.3
Installing ri documentation for rubygems-update-3.3.3
Installing darkfish documentation for rubygems-update-3.3.3
Done installing documentation for rubygems-update after 206 seconds
Parsing documentation for rubygems-update-3.3.3
Done installing documentation for rubygems-update after 0 seconds
Installing RubyGems 3.3.3
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted # rb_sysopen - /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/gem
% ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20]
Not sure what to do or try next.
Anyone have any ideas on how to get Compass installed?
This really decomposes to two issues, as you noticed with the sudo call.
(1) You're trying to write gems to the protected directory for your system Ruby.
In most development environments, it's best to install a Ruby version manager that allows you to install multiple Rubies side-by-side for different projects. Purely subjectively, I'd recommend rbenv to manage only Ruby, or asdf to manage Ruby versions along with other languages versions. However, the question of which Ruby version manager to use is very well tread already, so you can pick the solution that's best for your needs with existing information.
(2) You're installing a gem with native extensions, which means that you need the underlying C libraries installed on your system to build correctly (assuming you're using CRuby, the default Ruby implementation). You'll need to install libffi-dev on your machine to build that gem correctly. Based on this question, it seems a simple brew install libffi should work for that.
Lastly, I'll suggest that it's idiomatic to use the bundler gem to manage gems per-project with Ruby. I'd reconsider if you really want to run this gem system-wide, or if it might vary versions across multiple projects.

Unable to Install Shoes :ruby

I am beginner in ruby and wanted to install and GUI toolkit. So i surfed web and found shoes was one toolkit so i downloaded the ".install" file it didn't work saying some permission error, then i downloaded the older version which was ".run" format and that too didn't work so i found a gem of shoes when i try to download i get the below in ruby. i downloaded this shoes from git and still facing some error.
root#Drona:/home/naren/shoes4# gem install bundler && bundle install
Successfully installed bundler-1.10.5
1 gem installed
Installing ri documentation for bundler-1.10.5...
Installing RDoc documentation for bundler-1.10.5...
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all
non-root users on this machine.
Fetching gem metadata from https://rubygems.org/............
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies....
Using rake 10.4.2
Using addressable 2.3.8
Using after_do 0.3.1
Using ast 2.0.0
Using parser 2.2.2.6
Using astrolabe 1.3.0
Using benchmark-ips 2.2.0
Using bouncy-castle-java 1.5.0147
Using docile 1.1.5
Installing json 1.8.3 with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:1:in `<main>'
Gem files will remain installed in /var/lib/gems/1.9.1/gems/json-1.8.3 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/json-1.8.3/ext/json/ext/generator/gem_make.out
An error occurred while installing json (1.8.3), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.3'` succeeds before bundling.
the above is the terminal output.
Ruby version installed is :
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
someone help we out with this installation
and if i have done anything wrong in installation of shoes then let me know
From your terminal directory it seems like you are trying to install shoes4 on ruby 1.9.3. To install shoes4 you need JRuby and a JDK - please follow the instructions in the readme
Shoes 3 can't be installed through gem install due to the way it was built. For Shoes 3 you need the install script, I recommend the appropriate Shoes 3.2 version from this page. If this fails with some error please let us know the error so we can help :)
You should use the gem program to install shoes. If on your command line you type gem install shoes you should be fine.
to use it in an app, you would need to create a Gemfile and run Bundle install within your folder

Running Jekyll on Windows 7

I'm having an issue with running Jekyll on windows 7. When I run
jekyll
I get the following error
C:\temp\jekyll\kouphax.github.com> jekyll
Configuration from C:/temp/jekyll/kouphax.github.com/_config.yml
Building site: C:/temp/jekyll/kouphax.github.com -> C:/temp/jekyll/kouphax.github.com/_site
unit-testing
You are missing a library required for Textile. Please run:
$ [sudo] gem install RedCloth
ERROR: YOUR SITE COULD NOT BE BUILT:
------------------------------------
Missing dependency: RedCloth
However RedCloth IS installed
C:\temp\jekyll\kouphax.github.com> gem install RedCloth
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Successfully installed RedCloth-4.2.8
1 gem installed
Installing ri documentation for RedCloth-4.2.8...
Installing RDoc documentation for RedCloth-4.2.8...
Can anyone enlighten me?
I followed the instructions here and that fixed my problem.
After gem install RedCloth run redcloth.bat from \Ruby\bin (replace \Ruby\ with the Ruby installation dir).
If it complains about not finding the path 1.9/redcloth_scan then do the following:
Create a dir named 1.9 in \Ruby\lib\ruby\gems\1.9.1\gems\RedCloth-4.2.8\ext
Copy everything from \Ruby\lib\ruby\gems\1.9.1\gems\RedCloth-4.2.8\ext\redcloth_scan in the 1.9 folder just created.
Try uninstalling the gems and reinstalling them. RedCloth first and then Textile so that it makes sure to see RedCloth.
(I'm new to ruby, so that may not even make sense, but it seems like it's worth a shot.)
Try download and reinstall the latest ruby ,then follow this instruction, good luck!

Using RubyGems on ubuntu server

I have installed Ruby on Rails on my Ubuntu 10.04 Server by official tutorial: https://help.ubuntu.com/10.04/serverguide/C/ruby-on-rails.html
But I have some troubles with it. Please, help me!
1) I can't install ANY gem!
sudo gem install sqlite3-ruby
returns
ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native
extension.
/usr/bin/ruby1.8 extconf.rb
extconf.rb:3:in `require': no such
file to load -- mkmf (LoadError) from
extconf.rb:3
Gem files will remain installed in
/var/lib/gems/1.8/gems/sqlite3-1.3.3
for inspection. Results logged to
/var/lib/gems/1.8/gems/sqlite3-1.3.3/ext/sqlite3/gem_make.out
2) When i'am trying to get Rails version by command
rails -v
Server prints:
getopt: invalid option -- 'v'
Terminating...
If you are not set on using the packages in the Ubuntu repos(and I see no reason why you'd be), I'd suggest following this guide:
http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you
Consider going through and making sure your sqlite3 libraries are installed. It looks as though you may be missing the required dependencies to build your gem. In this case you might try running this before installing your gem:
sudo apt-get install libsqlite3-dev
Also, try
rails --version
instead.

Ruby-LDAP and Snow Leopard

When I install Ruby-LDAP on my Snow Leopard box, all appears to go well:
$ sudo gem install ruby-ldap
Building native extensions. This could take a while...
Successfully installed ruby-ldap-0.9.9
1 gem installed
Installing ri documentation for ruby-ldap-0.9.9...
Installing RDoc documentation for ruby-ldap-0.9.9...
But when I run the Ruby script that relies on it, I get this error:
in 'require': no such file to load -- ldap (LoadError)
I also tried setting ARCHFLAGS, since doing so appears to be required for the MySQL gem to function correctly in Snow Leopard:
$ sudo env ARCHFLAGS="-arch x86_64" gem install ruby-ldap
Unfortunately, this produces exactly the same results (or lack thereof).
How do I get Ruby to work with the LDAP libraries correctly here?
Make sure you
require 'rubygems'
first.
gem install ruby-ldap

Resources