Spork-rails, rails 3.2 and 'no such file to load' - ruby-on-rails

I'm having trouble with Rails 3.2 + Spork. When I run bundle exec spork I get the error:
/usr/local/rvm/gems/ruby-1.9.2-p290#rails-3.2.1/bin/spork:19:in `load': no such file to load -- /usr/local/rvm/gems/ruby-1.9.2-p290#rails-3.2.1/gems/spork-1.0.0rc2/bin/spork (LoadError)
from /usr/local/rvm/gems/ruby-1.9.2-p290#rails-3.2.1/bin/spork:19:in `<main>'
As you might have noticed, I'm using RVM to manage my gems. Several times, I've tried reinstalling all my gems in a new gemset. I haven't had any luck. Has anyone else run into this?
I've created a Gist for of my Gemfile:
https://gist.github.com/1921929
Gist for my bundle:
https://gist.github.com/1925661

I figured it out. It was permissions related. Running bundle exec spork would give me the error that's seen above. It had occurred to me that I might need to run it as sudo bundle exec spork and when I did I received a different error.
I just ran the command as rvmsudo or rvmsudo bundle exec spork, since I'm using RVM, and it worked just fine. It turns out that this had nothing to do with Spork having any issues. Thanks everyone for taking a look.

Related

Ruby rake loaderror - bundle exec rake not working

I'm trying to run the command rake db:migrate but I keep getting this error:
/Users/[name]/.rvm/gems/ruby-2.2.1/bin/rake:23:in `load': cannot load such file -- /Users/[name]/.rvm/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0/specifications/default/bin/rake (LoadError)
from /Users/[name]/.rvm/gems/ruby-2.2.1/bin/rake:23:in `<main>'
from /Users/[name]/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `eval'
from /Users/[name]/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `<main>'
Trying bundle exec rake db:migrate also gives me the same error.
Is there a way I can solve this issue? (I'm on Mac OS X 10.10.5)
EDIT: The first letter of my [name] in the error is upper case even though in my system, it's lower case.
EDIT [PARTIALLY SOLVED]: So I was using Ruby version 2.2.1 and I was supposed to use 2.1.2. Although this did not fix the rake command error, I was trying to run rails server which successfully ran after changing my Ruby version.
If none of the above mentioned comments worked for you, then I suspect you may need to update rake gem. Try:
bundle update rake
See if that fixes the issue. If not, let me know. I will update the answer.
/bin/ruby_executable_hooks.rb error indicates that the error is coming from a Bundler hook. Try to delete the .bundle directory in your project root path and see if the error is gone.

Issue with bundler (ruby)

When I run this command (step 5 of Redmine installation):
bundle exec rake generate_secret_token
I get this error message:
bundler: command not found: rake
Install missing gem executables with `bundle install`
But rake is already installed.
Can somebody help me?
Thanks a lot.
Notes:
1) 'bundle install --local' works fine
2) 'rake' didn't exist originally (what quite surprised me as I took the original redmine Gemfile), so I added the line. Same effect, sadly.
3) 'rake' alone works fine. It's when I write the whole command that I get this message
You should run bundle install. It will download and install all gems required for running application.

Rails rake updating issue - Could not find rake-10.4.2 in any of the sources

I'm attempting (without much success) to run rake db:migrate on a rails project, however it returns:
Could not find rake-10.4.2 in any of the sources
Run bundle install to install missing gems.
I ran bundle install and worked fine - installed rake 10.4.2, however when I ran: rake --version (for some reason you can't do rake -v ???) and it shows: rake, version 0.9.6
I ran bundle update rake and returned my list of gems and then: Your bundle is updated!
Why isn't rake updating? Is there something I'm doing wrong (I'm new to rails btw - so this is probably really simple)
Any help is really appreciated
TL; DR: gem install rake -v '10.4.2'
So, I had this problem myself. I wanted to know why rails s would work yesterday and not today.
First I checked if I was in the correct directory, I was.
Then I re-ran bundle install to make sure rake was getting installed. It was, and I was able to see it in my Gemfile.lock
So I figured my gemset might be corrupt (I use RVM). rvm gemset empty then bundle install
Still, whenever I ran rails s, I got this error. bin/rails s worked, as well as bundle exec rails s. But I don't want a prefix, I want rails to work (It works in other rails projects)
Eventually I tried gem install rake and it worked! I recommend adding -v '10.4.2' to the command so that you get the correct rake version. Now when I which rake, I get the gemset for my project: "/Users/cm022291/.rvm/gems/ruby-2.2.1#project_gemset/bin/rake"
and when I run rails s the server starts successfully.
Try typing
bundle exec rake db:migrate
That will ensure that the Rake being invoked is the one you've bundled.

Rails 3.2.1 - Could not find rake-0.9.2.2 in any of the sources

I'm brand new to rails and am trying to dive in to my first project on my Mac, but am running in to an issue when I run Rake -T inside my project's root dir:
Could not find rake-0.9.2.2 in any of the sources
Run 'bundle install' to install missing gems.
After I run 'bundle install' I get:
Your bundle is complete! It was installed into ./rake
But I still get the same error when I call Rake again. My gemfile lists rake as:
gem 'rake', '0.9.2.2'
If I run 'bundle list' I can see:
* rake (0.9.2.2)
I've looked at other posts on stackoverflow and google, but none of the solutions have worked for me. I'd also really appreciate any background on what's going on here, for instance, should rake be installed in to the project directory like this?
I'm not sure what else I should include to help troubleshoot?
Thank you!
Go to https://rvm.io
instal rvm, rvm install 1.9.3, rvm use 1.9.3 --default
then you can manage your gems through rvm
It is the best solution to manage your gems.
please check if rvm is configured correctly - read about .rvmrc and setup_and_load_paths.rb http://blog.ninjahideout.com/posts/the-path-to-better-rvm-and-passenger-integration, also check lines at your nginx(i suppose you use it, cause, i just had exactly same problem) configs passenger_root and passenger_ruby (this one should include smth like output of which ruby + #your_gem_set)
good luck
Have you tried Gem install rake ?
Bundle will not install anything to your path I do not think but you may also get it working by bundle exec rake. If that doesn't work, try bundle exec rake -v0.9.2.2.2
I don't fully understand how bundle works either as running Rails commands on my computer runs Rails 3.2.2 while the bundle runs Rails 3.1.1

running rake fails with Gem::GemNotFoundException ERR

Backstory:
New to rails and attempting to install Passenger on a Mediatemple DV server. I am following and somewhat modifying this CentOS guide here since MT currently does not have any recommended 'how tos' regarding setting up a Rails production environment http://www.freshblurbs.com/installing-ruby-rails-3-centos-nginx.
I have fresh-ly installed gem and then ran gem install rake as root. Now, anytime I try to run
rake some_task
I get the following error
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:370:in `bin_path':
can't find gem rake ([">= 0"]) with executable rake (Gem::GemNotFoundException)
from /usr/local/bin/rake:19:in `<main>'
rake is installed here /usr/local/bin/rake
$PATH is /usr/kerberos/sbin:/usr/kerberos/bin://sbin://bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/bin:/usr/local/bin:/root/bin:/usr/bin:/usr/local/lib
output of gem which rake is /usr/local/lib/ruby/1.9.1/rake.rb
... and unfortunately that's about all I got up my sleeves. What am I missing that's causing this to bomb?
Thanks in advance!
I have the similar problem with rake, but in ruby 1.9.2.
http://betterlogic.com/roger/2010/11/ruby-1-9-2-rake-woe/
Maybe in your case it will be helpful too.
Not sure this'll help maybe it will.. maybe not..
But run a gem list first and make sure both rake and also the passenger gem show up. I think I remember seeing a similar error that was misleading trying to setup a production server recently when running:
passenger-install-apache2-module
face palmed when I realised i hadn't installed the passenger gem yet

Resources