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.
Related
I have a problem with Solidus 2.10.2 where when I run rails g spree:install several migration errors come up. Starting with [Spree WARNING] Missing migrations. and ending with [Spree WARNING] Run bundle exec rake railties:install:migrations to get them. but when I run bundle exec rake railties:install:migrations nothing happens...
I tried deleting the database (rails db:drop) and all my custom migration files as well before running the spree generator again however I get the same results. I put the full error in a bitbucket snippet (https://bitbucket.org/goldenBoySailsLow/workspace/snippets/5LGqez) I would appreciate any help
system info: rails 5.2.4.4, ruby 2.7.2, ImageMagick 6.9.10-23 and sqlite3 3.31.1 running on ubuntu 20.04 lts
I just had the same issue because I forgot to specify the version in the Gemfile. When I deployed, it started using solidus 2.11.2 instead of 2.10.2.
Specifying the version solved the problem for me.
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.
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.
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
I'm trying to setup a new rails 3 project with bundler, but i ran into issues with bundler.
I'm on rails 3.0.3 with ruby 1.8.7
When trying to do
$ bundle exec rake db:migrate
I get the following error
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/dependency.rb:52:in `initialize': Valid types are [:development, :runtime], not nil (ArgumentError)
Same goes for when I try to issue a regular rake task in my terminal, one like
$ rake -T i.e., only then I get the error:
uninitialized constant Bundler /Users/daniel/cc/contributie_data/Rakefile:4 (See full trace by running task with --trace)
I've been reading some other questions regarding this problem, therefore i've learned it has something to do with paths...
$ which rake
/usr/bin/rake
$ which ruby
/usr/local/bin/ruby
Can anyone give me some suggestions about what could be happening here?
And even more important, how I can get bundler to play nice with rake..
Thanks for any input on this, much appreciated!
I got the same error (I'm using rvm). It turned out that in both my .profile and .bashrc was the following statement:
export PATH=~/.gem/ruby/1.8/bin:$PATH
So this path was taken instead of the rvm path. I commented these lines out and now everything works fine
Try to delete Gemfile.lock. It usually helps with
Valid types are [:development, :runtime], not nil
error.
Oh man, I just when through this today.
I did an update, and my rvm broke -- started throwing up on missing scripts and the like. I just got finished completely reinstalling rvm and my rubies.
it's not great, and it takes a while but it's what I did to get back to a working state.
Started here. How can I remove RVM (Ruby Version Manager) from my system? Ended up going through and installing fresh.
I too face the same issue and resolved it with the help of this link github:bundler
Modified a line in the file lib/bundler/resolver.rb which is reside inside bundler gem. Remove * mark from the line d = Gem::Dependency.new(base.first.name, *reqs)
like this:
reqs = [dep.requirement.as_list, base.first.version.to_s].flatten.compact
d = Gem::Dependency.new(base.first.name, *reqs)
to
reqs = [dep.requirement.as_list, base.first.version.to_s].flatten.compact
d = Gem::Dependency.new(base.first.name, reqs)
*modifying content of a gem directly is not a good practice. Posted this just to show another way to resolve this issue.