Sorry if the question is basic and forms of this has been asked. My sysadmin is out of the country so I'm stuck trying to figure this out. And none of the similar question has the exact situation (believe me I looked and have been banging my head against the wall for some time).
See below for my ruby/gem, which are all 1.9.3. Then upon running it somehow shows 1.9.1, not sure why. Anyway I've tried installing pg, the missing gem. It looked like it installed but re-running gives the same error message.
Please ask me any other information you feel is relevant.
rails#alpite:~/solr_indexer$ which ruby
/usr/local/rvm/rubies/ruby-1.9.3-p551/bin/ruby
rails#alpite:~/solr_indexer$ which gem
/usr/local/rvm/rubies/ruby-1.9.3-p551/bin/gem
rails#alpite:~/solr_indexer$ ruby indexer.rb
/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- pg (LoadError)
from /usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/rails/solr_indexer/cfg.rb:2:in `'
from /usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
from indexer.rb:1:in `'
rails#alpite:~/solr_indexer$ gem install pg
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/local/rvm/gems/ruby-1.9.3-p551 directory.
rails#alpite:~/solr_indexer$ sudo gem install pg
[sudo] password for rails:
Sorry, try again.
[sudo] password for rails:
Building native extensions. This could take a while...
Successfully installed pg-0.17.1
1 gem installed
Installing ri documentation for pg-0.17.1...
Installing RDoc documentation for pg-0.17.1...
rails#alpite:~/solr_indexer$ ruby indexer.rb
/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- pg (LoadError)
from /usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/rails/solr_indexer/cfg.rb:2:in `'
from /usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
from indexer.rb:1:in `'
You're using a multi-user RVM installation to manage multiple Rubies. When using that, don't use sudo to install gems. The RVM installation page says:
Note: The Multi-User install instructions must be prefixed with the sudo command. However, once the install is complete, and the instructions to add users to the rvm group is followed, the use of either sudo or rvmsudo is no longer required. The sudo command is only to temporarily elevate privileges so the installer can complete its work. If you need to use sudo or rvmsudo after the install is complete, some part of the install directions were not properly followed. This usually is because people execute the install as root, rather than executing the installation instructions from a non-privileged user account.
I'd recommend reading that entire page as it has important information for using RVM with your environment.
The "Sudo" page is also good reading.
Related
I installed ubuntu and want to install Ruby on Rails. But tried few times and see same error after I run 'rails new app' I see error
from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
/usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- bundler/setup (LoadError)
The server also doesn't run because of it.
You need to install Bundler first.
gem install bundler
Bundler is a Ruby gem. It's a Ruby gem used to manage other Ruby gems (often called dependencies).
can you try below command?
echo $GEM_PATH
and check the ruby version, Is that different version then ruby/2.5.0?
and if it's different then set your $GEM_PATH from below command.
SetEnv GEM_HOME /usr/lib/ruby/gems/1.8(set your path)
You need to use
gem install os
I've been developing on this project for about a year now, but about a month ago I ran into an issue where I had a gem installed that was incompatible with my version of ruby (using rbenv; 2.3.1). I blew up the directory, uninstalled all of my gems, uninstalled rbenv, then installed rbenv and ruby. My fellow developers haven't had any problem getting the project setup, but when I run bundle install, my install always seems to fail on therubyracer 0.12.3 with the following error:
Fetching therubyracer 0.12.3
Installing therubyracer 0.12.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/deaster/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/therubyracer-
0.12.3/ext/v8
/Users/deaster/.rbenv/versions/2.3.1/bin/ruby -r ./siteconf20191211-2125-b9wazv.rb extconf.rb
checking for main() in -lpthread... yes
checking for main() in -lobjc... yes
creating Makefile
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/deaster/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-18/2.3.0-
static/therubyracer-0.12.3/mkmf.log
current directory: /Users/deaster/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/therubyracer-
0.12.3/ext/v8
make "DESTDIR=" clean
/Users/deaster/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/make-0.3.1/bin/make:4:in `<top
(required)>': undefined local variable or method `make' for main:Object (NameError)
from /Users/deaster/.rbenv/versions/2.3.1/bin/make:23:in `load'
from /Users/deaster/.rbenv/versions/2.3.1/bin/make:23:in `<main>'
current directory: /Users/deaster/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/therubyracer-
0.12.3/ext/v8
make "DESTDIR="
/Users/deaster/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/make-0.3.1/bin/make:4:in `<top
(required)>': undefined local variable or method `make' for main:Object (NameError)
from /Users/deaster/.rbenv/versions/2.3.1/bin/make:23:in `load'
from /Users/deaster/.rbenv/versions/2.3.1/bin/make:23:in `<main>'
make failed, exit code 1
Gem files will remain installed in
/Users/deaster/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/therubyracer-0.12.3 for inspection.
Results logged to /Users/deaster/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-
18/2.3.0-static/therubyracer-0.12.3/gem_make.out
An error occurred while installing therubyracer (0.12.3), and Bundler cannot continue.
Make sure that `gem install therubyracer -v '0.12.3'` succeeds before bundling.
In Gemfile:
therubyracer
I can't seem to find this same error reproduced anywhere. Prior to the install, when I run which make I get:
developer.rhapsody.com git:(master) which make
/usr/bin/make
developer.rhapsody.com git:(master) make --version
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for i386-apple-darwin11.3.0
However, after I try to run gem install therubyracer -v '0.12.3', when I run which make I get
developer.rhapsody.com git:(master) which make
/Users/deaster/.rbenv/shims/make
developer.rhapsody.com git:(master) make --version
/Users/deaster/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/make-0.3.1/bin/make:4:in `<top
(required)>': undefined local variable or method `make' for main:Object (NameError)
from /Users/deaster/.rbenv/versions/2.3.1/bin/make:23:in `load'
from /Users/deaster/.rbenv/versions/2.3.1/bin/make:23:in `<main>'
I've blown up this project and rbenv several times in order to get this working but I can't get past this step. My team members never run into this error so they're having a hard time helping me get setup. I understand that something is wrong with the make gem, but I'm not sure how to fix it.
Any thoughts?
The make gem has nothing to do with the GNU make program.
A gem that shortcuts typing out forms and tables for SQL users.
Assuming your model is named ModelName, just type
Make.form.model("ModelName").now! in your controller and it will
return an html-safe form based on your column names for creating a new
record in your view. In addition, you can type
Make.table.model("ModelName").now! to automatically generate a table.
- https://rubygems.org/gems/make
Its just a really badly named gem of questionable quality.
Whats going on here is that you ran gem install make (or it was included in the Gemfile) and now the shim generated by RBenv is shadowing GNU make on your system. What I don't understand is how the gems authors could be so clueless and not see that this would be a HUGE problem.
Running $ gem uninstall make should fix the problem. Also ensure that its not in your Gemfile.
Fortunately, I was able to get this working.
Unfortunately I'm not sure what fixed the issue. I didn't make any more changes to the project or environment between getting the bundle install errors and then finally being successful. The only thing that happened was my VSCode ran into some unrelated issue and crashed my computer. When I booted back up, bundle install was successful and I was able to run the project. I'm not sure what that's indicative of, but I'm still looking for more insight in case I run into this in the future.
/Users/parkerharris/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/irb/completion.rb:10:in `require': dlopen(/Users/parkerharris/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle, 9): Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib (LoadError)
Referenced from: /Users/parkerharris/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle
Reason: image not found - /Users/parkerharris/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle
from /Users/parkerharris/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/irb/completion.rb:10:in `<top (required)>'
from /Users/parkerharris/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands/console.rb:3:in `require'
from /Users/parkerharris/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands/console.rb:3:in `<top (required)>'
from /Users/parkerharris/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:138:in `require'
from /Users/parkerharris/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:138:in `require_command!'
from /Users/parkerharris/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:68:in `console'
from /Users/parkerharris/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from /Users/parkerharris/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
This is my error screen after trying to execute the command. I've tried to uninstall and reinstall readline and that did not help. I am just learning rails and do not 100% know what I am doing (just following a guide) so this type of error is past my understanding. Thanks!
Might not be related, but I had the same thing happen to me today.
I had a fully-functioning Ruby 2.3.1 working fine this morning. In my case, Ruby was compiled and installed by ruby-build and managed by rbenv.
At one point today I updated Homebrew with
brew cleanup --prune=30
brew update
brew upgrade
One of the formulae upgraded was readline 7.0:
$ brew info readline
...
/usr/local/Cellar/readline/7.0 (45 files, 2M)
Poured from bottle on 2016-10-05 at 08:09:22
Shortly afterwords I found that my readline support for Ruby had become completely broken. I saw errors just like yours:
/Users/mbrictson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/pry-0.10.4/lib/pry/config/default.rb:151:in `require': dlopen(/Users/mbrictson/.rbenv/versions/2.3.1/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle, 9): Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib (LoadError)
Referenced from: /Users/mbrictson/.rbenv/versions/2.3.1/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle
Reason: image not found - /Users/mbrictson/.rbenv/versions/2.3.1/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle
from /Users/mbrictson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/pry-0.10.4/lib/pry/config/default.rb:151:in `lazy_readline'
The solution was to completely delete my Ruby installation and recompile it:
rm -rf ~/.rbenv/versions/2.3.1
rbenv install 2.3.1
I know you are using rvm and not rbenv, but perhaps the solution in your case is similar: delete your Ruby installation and re-install it using rvm.
A really fast and quick solution is to add rb-readline to your Gemfile.
(In case the other solutions don't work and you want to move on until you have time to address the issue. I know it this is not ideal but it is a working solution.)
In the GemFile:
group :development do
gem 'rb-readline'
end
Now, just bundle install. I found this solution on Option 4 at
(https://github.com/guard/guard/wiki/Add-Readline-support-to-Ruby-on-Mac-OS-X)
I hope it helps.
There's something wrong with your rvm, it doesn't seems to be related with rails. Please verify if it's installed properly.
Ensure that you've checked the rvm prerequisites on https://rvm.io/rvm/prerequisites
and that your install is working properly, e.g.
(from: https://rvm.io/rvm/install)
If installation and configuration were successful, RVM should now load whenever you open a new shell. This can be tested by executing the following command which should output rvm is a function as shown below.
$ type rvm | head -n 1
rvm is a function
Check on your mac if readline has been properly compiled, or try to do a clean install ruby-2.3.0 again
You can check on RVM regarding the package and autolibs on: https://rvm.io/packages/readline
I had similar issue. My Ruby was installed using HomeBrew. In my case I needed to uninstall Ruby; install/link libyaml; and then reinstall ruby.
brew uninstall ruby
brew link libyaml
brew install ruby
Same thing happened to me when I unwittingly ran rvm requirements after installing ruby 2.3.1.
rvm uninstall 2.3.1
rvm install 2.3.1
Above fixed it.
Running this from the command line worked for me:
ln -s /usr/local/opt/readline/lib/libreadline.7.0.dylib /usr/local/opt/readline/lib/libreadline.6.dylib
from github
I am trying to create a new Rails project,
Jakes-Air:code JakeWengroff$ rails new MyNewProject -T
but I keep getting this error:
script/rails:5:in `require': cannot load such file -- /Users/JakeWengroff/config/boot (LoadError)
from script/rails:5:in `<main>'
Checking the Ruby version, ruby -v, I get
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
When I want to check the version of Rails, rails -v, I get the same error as when I want to initiate a new Rails proejct:
script/rails:5:in `require': cannot load such file -- /Users/JakeWengroff/config/boot (LoadError)
from script/rails:5:in `<main>'
So, I reinstalled Rails, gem install rails -v 4.2.0:
Successfully installed rails-4.2.0
Parsing documentation for rails-4.2.0
Done installing documentation for rails after 1 seconds
1 gem installed
I also did bundle install and bundle check and everything was fine. But the error persisted.
After reviewing some other, similar questions here, I thought it had to do with gemsets. From the RVM website, I decided to try rvm gemset create rails420, which gave me
ruby-2.1.2 - #gemset created /Users/JakeWengroff/.rvm/gems/ruby-2.1.2#rails420
ruby-2.1.2 - #generating rails420 wrappers..............
But then trying rails -v and rails new MyNewProject -T still threw the original error.
Any help is greatly appreciated.
Thank you in advance.
I had a similar issue, for me it turned out to be a problem with ruby. I have installed a different version of Ruby with RVM and installed the rails gem with this other version of Ruby.
rvm install 2.2.2
gem install rails
I would not recommend this solution as a sustainable one, but I couldn't solve this in a different way and at least it will get you going again.
I was looking at replacing RVM with rbenv since I am using bundle to manage my gemfiles. rbenv, I believe, is a lot lighter in managing my Ruby versions, so I uninstalled RVM and installed rbenv. I installed the bundler gem using
gem install bundler
because we need it everywhere. Then I opened a project and installed the required version Ruby using rbenv:
rbenv install 1.9.3-p194
rbenv local 1.9.3-p194
rbenv rehash
I entered ruby -v to make sure it was using the right version of Ruby, and it was, so I tried running bundle and it ran until it tried to install RedCloth and and then failed:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb --with-cflags=-w
/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>'
It suggested that I install RedCoth before bundling, so I installed RedCloth:
gem install RedCloth
which succeeded. I then ran ruby -v, just to make sure it's still right, then tried running bundle update and the same error occured:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb --with-cflags=-w
/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 /home/ruberto/.bundler/tmp/7551/gems/RedCloth-4.2.9 for inspection.
Results logged to /home/ruberto/.bundler/tmp/7551/gems/RedCloth-4.2.9/ext/redcloth_scan/gem_make.out
An error occurred while installing RedCloth (4.2.9), and Bundler cannot continue.
Make sure that `gem install RedCloth -v '4.2.9'` succeeds before bundling.
I then tried installing a different version of Ruby but had no success there either.
Does anyone have ideas?
I subsequently tried doing the same thing in my other projects and it all seems to work just fine. I have one that uses 1.8.7 and it was as easy as setting the rbenv to the right version and then running bundle. I tried almost every combination of Ruby version and yet it's not working.
I had a similar problem. It turned out that, even though I had the ~/.rbenv/shims directory at the front of my path, zsh was caching the location of bundle to /usr/local/bin/bundle.
The solution was simply running rehash at the shell (not rbenv rehash). This flushed all the cached commands, including bundle, and all went well after that.
I finally overcame the problem.
I had installed a wrong version of Ruby 1.8.7-p370. I then ran bundle and that had some gems compiling the native extensions against Ruby 1.8.7 when the bundle was for a 1.9.3 package, so even if I was to switch over to the 1.9.3 version and try running bundle again it would bomb out.
To fix this, I simply removed all the gems and then installed the right version of Ruby and then re-ran bundle.