> luke#Macbook-Pro~/Documents/workspace/RoR/rails_projects/sample4_app$ ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-darwin10.8.0]
luke#Macbook-Pro~/Documents/workspace/RoR/rails_projects/sample4_app$ rails -v
Rails 3.0.9
luke#Macbook-Pro~/Documents/workspace/RoR/rails_projects/sample4_app$ rails console
/Users/luke/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/i686-darwin10.8.0/readline.bundle: dlopen(/Users/luke/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/i686-darwin10.8.0/readline.bundle, 9): Symbol not found: _rl_basic_quote_characters (LoadError)
Referenced from: /Users/luke/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/i686-darwin10.8.0/readline.bundle
Expected in: flat namespace
in /Users/luke/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/i686-darwin10.8.0/readline.bundle - /Users/luke/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/i686-darwin10.8.0/readline.bundle
from /Users/luke/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/irb/completion.rb:10
from /Users/luke/.rvm/gems/ruby-1.8.7-p352/gems/railties-3.0.9/lib/rails/commands/console.rb:3:in `require'
from /Users/luke/.rvm/gems/ruby-1.8.7-p352/gems/railties-3.0.9/lib/rails/commands/console.rb:3
from /Users/luke/.rvm/gems/ruby-1.8.7-p352/gems/railties-3.0.9/lib/rails/commands.rb:20:in `require'
from /Users/luke/.rvm/gems/ruby-1.8.7-p352/gems/railties-3.0.9/lib/rails/commands.rb:20
from script/rails:6:in `require'
from script/rails:6
Ruby is okay, Rails is okay, but "rails console"
Need help
Thanks
Looks like you're missing a file in your ruby build. Did you just recently update to OS X 10.7? You might need a fresh reinstall of Rails. As always this can be done with:
sudo gem install rails
Sorry I can't be of more help.
Suggest using bundler to manage the gems in your project.
If you put
source 'http://rubygems.org'
gem 'rails', '3.0.9'
in your Gemfile (see also http://gembundler.com/ )
Then
bundle install
will install the correct version of rails and
bundle exec rails console
will start up your console. bundle exec rails server will start the server, etc.
You might also want to consider using rvm to install and manage your rubies if you aren't already -- http://beginrescueend.com/
Related
I have cloned an existing project from github. I installed Ruby and installed Rails on my Terminal.
When I do ruby -v I get ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-darwin18]
When I do rails -v I get Rails 6.0.3.1
However when I navigate into my project that I want to run on local host and run the same commands:
for ruby -v I get ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-darwin18] which is the same.
and for rails -v I get:
Traceback (most recent call last):
4: from bin/rails:3:in `<main>'
3: from bin/rails:3:in `load'
2: from /Users/angelainniss/WebstormProjects/legitkitchen/bin/spring:8:in `<top (required)>'
1: from /Users/angelainniss/.rbenv/versions/2.5.3/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
/Users/angelainniss/.rbenv/versions/2.5.3/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- bundler (LoadError)
Has anyone ever had this or do they understand why rails isn't working?
Well, rails command is pretty smart and it knows it will be usually called within the rails project folder. So it have its binstubs - basically those are just a slightly modified commands that lives in your project bin folder, with some additional, project-related power-ups. Regular rails command (and other commands as well) will always check if bin/rails is present in current directory and will use it if it exists. This is why rails -v worked fine outside of your project but didn't inside project folder.
One of the bin/rails superpowers is automatic requiring of all dependencies defined in your project Gemfile. This is normally done through another gem called bundler. Bundler is basically always the first gem you're gona install in your local Ruby environment.
But, you didn't install it yet. Just run gem install bundler to get that running. You will still need to install all the dependencies, you do this via bundle install.
Did you do, gem install bundler before running bundle install after cloning the project?
I have a rails 2 app and I'm trying to upgrade to Rails 3.1.0 first.
After doing a bit of research, I found this plugin:
https://github.com/rails/rails_upgrade
Which states that the first I have to install a plugin with:
script/plugin install git://github.com/rails/rails_upgrade.git
However, I get this error:
/home/bogdan/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- script/../config/boot (LoadError)
from /home/bogdan/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from script/plugin:2:in `<main>'
My script/plugin file:
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/plugin'
I can run script/server script/console or script/dbconsole with no problem.
What am I doing wrong?
I didn't think that would be the answer but use ruby 1.8.7.
Using an old rails 2 app with ruby 1.9.3 or 2 script/plugin doesn't work, with 1.8.7 script/plugin does for me
I had the exact same problem...ran all over and found the oddest solution
./script/plugin install git://github.com/rails/rails_upgrade.git
and I kept ruby 1.9.3p194 and rails 2.3.14
no 1.8.7 needed
I am trying to run a Rails 2.3 app locally.
script/server gives me these errors:
bash: script/server: Permission denied
bash: parse_git_branch: command not found
script/server gives me the error:
/Users/stevenbrooks1111/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require': cannot load such file -- initializer (LoadError)
from /Users/stevenbrooks1111/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /Users/stevenbrooks1111/Desktop/cssmixonline/cssweb/config/boot.rb:55:in `load_initializer'
from /Users/stevenbrooks1111/Desktop/cssmixonline/cssweb/config/boot.rb:38:in `run'
from /Users/stevenbrooks1111/Desktop/cssmixonline/cssweb/config/boot.rb:11:in `boot!'
from /Users/stevenbrooks1111/Desktop/cssmixonline/cssweb/config/boot.rb:110:in `<top (required)>'
from /Users/stevenbrooks1111/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/stevenbrooks1111/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from script/server:2:in `<main>'
bash: parse_git_branch: command not found
Any ideas of how I can get this to run locally?
This question is what I've been doing for the past month. I would have loved to use Rails 4, but I know better than to try it!
Install rvm or rbenv, then get into a server that correctly runs this app, and run
ruby --version
gem list > ~/myGems.txt
Using rvm or rbenv, install the exact same version of Ruby.
(Tip: whenever I say "exact same", you can fudge by bumping the revision. For example, given a gem with version 0.1.4, if it has subsequent versions 0.1.5, 0.1.6, and 0.2.0, you can bump to 0.1.6, if that will save you some grief. The revision numbers, 0.1.*, are supposed to be only bug fixes. But a minor version bump, 0.2.0, has higher odds of breaking things. I kept the same version of Ruby, but I bumped rails to 2.3.14.)
Using rvm or rbenv, install the same version of Ruby as currently runs on this app's main server.
Inside this Ruby environment (with both which ruby and ruby --version reporting the correct answers), install each gem in myGems.txt, like this:
gem install --ignore-dependencies --no-rdoc --no-ri my_gem -v=0.1.4
The --ignore-dependencies is critical, because some gems from the Pleistocene Epoch, 2009, don't specify their dependencies' versions. When some dumb 2009 gem pulls in the 2013 rake, you will be utterly screwed, because reverting that rake is really hard. And don't forget to set the -v to the same value as myGems.txt reports!
After all that, try simple rake commands like rake routes. Post any bugs you get as fresh questions, but remember to point out Rails 2.3 in the subject so nobody mis-answers with the modern fixes.
And if this app has tests or specs, getting them running should be a top priority, so you can resume TDD, leaning on the tests to allow you to make sick changes.
Can someone help me out with something seemingly simple? My newness to Ruby on Rails is the reason, no doubt. I cannot start up the server. It looks like the boot file cannot be located but I'm nor sure at all.
There are several versions of ruby here, related to installing rvm:
which -a ruby
/Users/me/.rvm/rubies/ruby-1.9.3-p327/bin/ruby
/Users/me/.rvm/bin/ruby
/usr/local/bin/ruby
/usr/bin/ruby
Probably need to remove some?
Using Rails 3.2.9 with Ruby 1.9.3 on a Mac Mini
Thanks!
cd [rails project dir]
$ script/server
/Users/me/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require':
cannot load such file -- script/../config/boot (LoadError)
from /Users/me/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from script/server:2:in `'
This isn't the issue you are getting. script/server still works, what you are experiencing is an issue with the gems you are trying to use. What you might try is running rails s --trace, see what gems are causing the issue and manually reinstalling them. From the looks of it, it's just an issue with a lone gem with dependencies in 1.9.1.
With Rails 3+ you get access to the rails command line scripts so instead of calling script/server you just run rails server or rails s for short.
I am trying to run some basic tests in my rails app following the edgeguides.
My rails app is working fine, it's only when trying to run the tests.
When running a test, I get:
.../config/boot.rb:1:in `require': no such file to load -- rubygems (LoadError)
from /Users/olivier_ntk/Sites/tennis/config/boot.rb:1
from /Users/olivier_ntk/Sites/tennis/config/application.rb:1:in `require'
from /Users/olivier_ntk/Sites/tennis/config/application.rb:1
from /Users/olivier_ntk/Sites/tennis/config/environment.rb:2:in `require'
from /Users/olivier_ntk/Sites/tennis/config/environment.rb:2
from ./test/test_helper.rb:2:in `require'
from ./test/test_helper.rb:2
from test/unit/club_test.rb:1:in `require'
from test/unit/club_test.rb:1
$ ruby -v
ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-darwin10]
$ rails -v
Rails 3.0.6
$ gem -v
1.3.7
However, when I run which -a ruby, I get:
/opt/local/bin/ruby
/opt/local/bin/ruby
/opt/local/bin/ruby
I am not sure why I get 3 lines and if that is affecting calling ruby ...
What command are you using to start the tests?
Try using "rake test" from your app's main directory (in your case that seems to be "/Users/olivier_ntk/Sites/tennis").
If you're already doing that, run:
head -1 `which rake`
and reply with what ruby path you see.
Try typing in gem env for more details.
I tried seeing if this question has been asked before. I don't think the following have the exact same problem as you do, but they may help you uncover what the problem is, or you may want to look for questions listed under "related" to these questions:
no such file to load -- rubygems (LoadError)
ruby gem not found although it is installed
Error loading rubygems