Rails generate commands not working - ruby-on-rails

I'm trying to create a migration using the rails generator, but when I run rails g migration create_meetups_tableI get the following output:
Could not find slop-3.4.7 in any of the sources
Run `bundle install` to install missing gems.
I installed the gem manually and then ran bundle install again and got this output:
Using i18n 0.6.9
Using json 1.8.1
Using minitest 5.3.4
Using thread_safe 0.3.4
Using builder 3.2.2
Using erubis 2.7.0
Using rake 10.3.2
Using rack 1.5.2
Using polyglot 0.3.5
Using mime-types 1.25.1
Using arel 5.0.1.20140414130214
Using bcrypt 3.1.7
Using coderay 1.1.0
Using coffee-script-source 1.7.0
Using execjs 2.2.0
Using thor 0.19.1
Using orm_adapter 0.5.0
Using geocoder 1.2.2
Using hike 1.2.3
Using multi_json 1.10.1
Using method_source 0.8.2
Using pg 0.17.1
Using slop 3.4.7
Using bundler 1.6.2
Using tilt 1.4.1
Using sass 3.2.19
Using spring 1.1.3
Using rdoc 4.1.1
Using tzinfo 1.2.1
Using rack-test 0.6.2
Using warden 1.2.3
Using treetop 1.4.15
Using coffee-script 2.2.0
Using uglifier 2.5.1
Using pry 0.9.12.4
Using sprockets 2.11.0
Using sdoc 0.4.0
Using activesupport 4.1.1
Using mail 2.5.4
Using actionview 4.1.1
Using activemodel 4.1.1
Using jbuilder 2.1.0
Using actionpack 4.1.1
Using activerecord 4.1.1
Using actionmailer 4.1.1
Using railties 4.1.1
Using sprockets-rails 2.1.3
Using coffee-rails 4.0.1
Using devise 3.2.4
Using jquery-rails 3.1.0
Using rails 4.1.1
Using sass-rails 4.0.3
Using rMeetup 1.0.1 from git://github.com/tannermares/rmeetup.git (at master)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
I can clearly see that the gem is being bundled. I can run other commands for starting the app and the console but can't run the generate migrations. Any thoughts on how to fix this? I've tried the deleting the install of ruby and reinstalling but that did not help.

I think Spring is misbehaving, and not re-requiring gems correctly.
Check spring's status with bin/spring status. If it's running, try stopping it with bin/spring stop. If it's not, check to see if there are any orphan Spring processes that might be screwing things up:
ps aux | grep spring.
I'm not entirely sure why Spring is acting like this, but killing it off fixed the issue for me. I was unable to replicate again to investigate further.

You may well be picking up the wrong version of Rails. Prefixing your rails commands with bundle exec should sort things out for you so
rails g migration create_meetups_table
becomes
bundle exec rails g migration create_meetups_table
Also add the gem to your Gemfile.rb and run bundle install this will ensure that bundler is knows about the right gems when you use it to execute rails commands.
Using RVM or RBENV might be a better long term solution for you.
https://rvm.io/
https://github.com/sstephenson/rbenv

Related

Bundler not able to use gem?

This is what is currently in my terminal. After Successfully setting up a rails app and making sure it worked. I set up the gem react-rails in my gem file. Then committed everything and from there I ran bundle install. Then I got an error stating that it could not find the babel-source-5.8.35 in any of the sources. but clearly its in my bundle ENV
➜ calendaract git:(master) bundle install
Using rake 12.3.1
Using concurrent-ruby 1.0.5
Using i18n 0.9.5
Using minitest 5.11.3
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using builder 3.2.3
Using erubi 1.7.1
Using mini_portile2 2.3.0
Using nokogiri 1.8.2
Using rails-dom-testing 2.0.3
Using crass 1.0.3
Using loofah 2.2.2
Using rails-html-sanitizer 1.0.4
Using actionview 5.1.5
Using rack 2.0.4
Using rack-test 0.8.3
Using actionpack 5.1.5
Using nio4r 2.3.0
Using websocket-extensions 0.1.3
Using websocket-driver 0.6.5
Using actioncable 5.1.5
Using globalid 0.4.1
Using activejob 5.1.5
Using mini_mime 1.0.0
Using mail 2.7.0
Using actionmailer 5.1.5
Using activemodel 5.1.5
Using arel 8.0.0
Using activerecord 5.1.5
Using public_suffix 3.0.2
Using addressable 2.5.2
***Using babel-source 5.8.35***
Using execjs 2.7.0
Using babel-transpiler 0.7.0
Using bindex 0.5.0
Using bundler 1.16.1
Using byebug 10.0.1
Using xpath 3.0.0
Using capybara 2.18.0
Using ffi 1.9.23
Using childprocess 0.9.0
Using coffee-script-source 1.12.2
Using coffee-script 2.4.1
Using method_source 0.9.0
Using thor 0.20.0
Using railties 5.1.5
Using coffee-rails 4.2.2
Using connection_pool 2.2.1
Using multi_json 1.13.1
Using jbuilder 2.7.0
Using rb-fsevent 0.10.3
Using rb-inotify 0.9.10
Using ruby_dep 1.5.0
Using listen 3.1.5
Using pg 1.0.0
Using puma 3.11.3
Using sprockets 3.7.1
Using sprockets-rails 3.2.1
Using rails 5.1.5
Using tilt 2.0.8
Using react-rails 2.4.4
Using rubyzip 1.2.1
Using sass-listen 4.0.0
Using sass 3.5.6
Using sass-rails 5.0.7
Using selenium-webdriver 3.11.0
Using spring 2.0.2
Using spring-watcher-listen 2.0.1
Using turbolinks-source 5.1.0
Using turbolinks 5.1.0
Using uglifier 4.1.8
Using web-console 3.5.1
Bundle complete! 17 Gemfile dependencies, 74 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
➜ calendaract git:(master) rails g react:install
Could not find babel-source-5.8.35 in any of the sources
Run `bundle install` to install missing gems.
So I Run bundle install, and clearly see my gem available locally all my paths and shims are set correctly. But when I run the generate script i get cannot find babel-source 5.8.35 and would love some help on what to do to be able to run?
rails generate react:install
It seems when you trying to do bundle install dependency for react-rails is missing so you need to either add babel-source to the Gemfile file list or install manually.
before starting check if that gem exist in your gem list:
gem list|grep babel-source # grep for ubuntu users you can use other alternative for other OS
and check whether it showing that gem and it is returning correct version or not else retry bundle install again as follows:
At first i suggest you to follow react github doc just make sure you haven't missed anything from it. if you still facing problem after that try adding that dependency gem as follows:
inside your Gemfile you can add this just above react-rails so that it meets the dependency when it tries to install. just make sure to remove Gemfile.lock so that it will be fresh installation.
gem 'babel-source', '~> 5.8.35'
then
bundle install
check whether your log and confirm your facing that error again or not if your facing again try manually you can run this in terminal:
gem install babel-source -v 5.8.35
then
bundle install
if it is successful run generate command for React.
all the above commands are debugging process since i cannot add much details into the comment option i'm posting it here so please let me know the results of it

Why doesn't "bundle exec" see that I have rake installed?

I've been reading StackOverflow and trying to deal with this error for 2 hours now:
bundle exec rake db:setup
Could not find rake-10.4.2 in any of the sources
Run `bundle install` to install missing gems.
I followed the advice here, to no avail:
rails s: Could not find rake-10.4.2 in any of the sources (Bundler::GemNotFound)
also:
Could not find rake with bundle exec
So I did:
gem uninstall rake
gem install rake
And, following the other StackOverflow articles I read, I tried:
rbenv install 2.3.1
Downloading ruby-2.3.1.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.1.tar.bz2
Installing ruby-2.3.1...
Installed ruby-2.3.1 to /Users/lkrubner/.rbenv/versions/2.3.1
rbenv global 2.3.1
ruby -v
ruby 2.0.0p645 (2015-04-13 revision 50299) [universal.x86_64-darwin15]
bundle exec rake db:setup
Could not find rake-10.4.2 in any of the sources
Run `bundle install` to install missing gems.
rbenv rehash
rbenv uninstall rake
rbenv: version `rake' not installed
At the command line, if I look for versions, I see:
rake -V
rake, version 11.2.2
rails -v
Rails 4.2.0
ruby -v
ruby 2.0.0p645 (2015-04-13 revision 50299) [universal.x86_64-darwin15]
but I still get this error:
bundle exec rake db:setup
Could not find rake-10.4.2 in any of the sources
Run `bundle install` to install missing gems.
What would fix this?
Update 1
This is even more confusing:
bundle update rake
Fetching gem metadata from https://rubygems.org/.............
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies...
Installing rake 11.2.2 (was 10.4.2)
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.8.3
Using thread_safe 0.3.5
Using tzinfo 1.2.2
Using activesupport 4.2.0
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile 0.6.2
Using nokogiri 1.6.6.4
Using rails-deprecated_sanitizer 1.0.3
Using rails-dom-testing 1.0.7
Using loofah 2.0.3
Using rails-html-sanitizer 1.0.2
Using actionview 4.2.0
Using rack 1.6.4
Using rack-test 0.6.3
Using actionpack 4.2.0
Using globalid 0.3.6
Using activejob 4.2.0
Using mime-types 2.99
Using mail 2.6.3
Using actionmailer 4.2.0
Using activemodel 4.2.0
Using arel 6.0.3
Using activerecord 4.2.0
Using addressable 2.3.8
Using multi_xml 0.5.5
Using httparty 0.13.7
Using uuidtools 2.1.5
Using aws-sdk 1.3.9
Using bcrypt 3.1.10
Using debug_inspector 0.0.2
Using binding_of_caller 0.7.2
Using bson 3.2.6
Using bson_ext 1.5.1
Using bundler 1.8.5
Using byebug 8.2.1
Using xpath 2.0.0
Using capybara 2.5.0
Using ffi 1.9.10
Using childprocess 0.5.8
Using climate_control 0.0.3
Using cocaine 0.5.8
Using coderay 1.1.0
Using coffee-script-source 1.10.0
Using execjs 2.6.0
Using coffee-script 2.4.1
Using thor 0.19.1
Using railties 4.2.0
Using coffee-rails 4.1.0
Using database_cleaner 1.5.1
Using orm_adapter 0.5.0
Using responders 2.1.0
Using warden 1.2.3
Using devise 3.5.2
Using diff-lcs 1.2.5
Using dotenv 2.1.0
Using dotenv-rails 2.1.0
Using factory_girl 4.5.0
Using factory_girl_rails 4.5.0
Using faker 1.4.3
Using multipart-post 2.0.0
Using faraday 0.9.2
Using sass 3.4.19
Using foundation-rails 5.5.3.2
Using geocoder 1.2.9
Using httpclient 2.6.0.1
Using icalendar 2.3.0
Using multi_json 1.11.2
Using jbuilder 2.3.2
Using jquery-rails 4.0.5
Using jwt 1.5.2
Using kgio 2.9.3
Using method_source 0.8.2
Using mimemagic 0.3.0
Using mongo 2.1.2
Using origin 2.1.1
Using mongoid 5.0.1
Using paperclip 4.3.2
Using mongoid-paperclip 0.0.10
Using oauth2 1.0.0
Using slop 3.6.0
Using pry 0.10.1
Using pry-rails 0.3.4
Using quiet_assets 1.1.0
Using sprockets 3.4.1
Using sprockets-rails 2.3.3
Using rails 4.2.0
Using rails_serve_static_assets 0.0.4
Using rails_stdout_logging 0.0.3
Using rails_12factor 0.0.3
Using raindrops 0.15.0
Using rdoc 4.2.0
Using rspec-support 3.3.0
Using rspec-core 3.3.1
Using rspec-expectations 3.3.0
Using rspec-mocks 3.3.1
Using rspec-rails 3.3.2
Using rspec_junit_formatter 0.2.2
Using rubyzip 1.1.7
Using tilt 2.0.1
Using sass-rails 5.0.4
Using sdoc 0.4.1
Using websocket 1.2.2
Using selenium-webdriver 2.48.1
Using shoulda-matchers 2.8.0
Using signet 0.7.2
Using simple_form 3.2.0
Using spring 1.4.4
Using timezone 0.5.0
Using turbolinks 2.5.3
Using uglifier 2.7.2
Using unicorn 4.9.0
Using web-console 2.2.1
Updating files in vendor/cache
* rake-11.2.2.gem
Removing outdated .gem files from vendor/cache
* rake-10.4.2.gem
Bundle updated!
bundle exec rake db:setup
Could not find rake-11.2.2 in any of the sources
Run `bundle install` to install missing gems.
bundle update rake
So one line says that rake is installed, and the next line says that it is not installed, and both lines are nominally being managed by Bundler, so in theory this can not be a cache problem.
Update 2
I added this to the Gem file:
gem 'rake', '10.5.0'
And then ran
bundle install
which gives me:
Updating files in vendor/cache
Bundle complete! 40 Gemfile dependencies, 116 gems now installed.
Bundled gems are installed into ./vendor/cache.
So then I try:
bundle exec rake db:setup
and I get:
Could not find rake-10.5.0 in any of the sources
Run `bundle install` to install missing gems.
You could try to run install command as sudo and specify rake's version like this:
sudo gem install rake -v '11.2.2'

Rails db:migrate can't find gems

I'm trying to run the rake db:migrate command, but when I run it it tells me there is not a gem installed. I'll run bundle install and it'll execute correctly, but then It'll once again tell me that a gem is not installed. The gem it's telling me is not installed is the minitest-5.8.0.
This is what shows up after I do bundle install
Using rake 10.4.2
Using ZenTest 4.11.0
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.8.0
Using thread_safe 0.3.5
Using tzinfo 1.2.2
Using activesupport 4.2.1
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile 0.6.2
Using nokogiri 1.6.6.2
Using rails-deprecated_sanitizer 1.0.3
Using rails-dom-testing 1.0.6
Using loofah 2.0.2
Using rails-html-sanitizer 1.0.2
Using actionview 4.2.1
Using rack 1.6.4
Using rack-test 0.6.3
Using actionpack 4.2.1
Using globalid 0.3.6
Using activejob 4.2.1
Using mime-types 2.6.1
Using mail 2.6.3
Using actionmailer 4.2.1
Using activemodel 4.2.1
Using arel 6.0.3
Using activerecord 4.2.1
Using autotest 4.4.6
Using debug_inspector 0.0.2
Using binding_of_caller 0.7.2
Using columnize 0.9.0
Using byebug 5.0.0
Using coffee-script-source 1.9.1.1
Using execjs 2.5.2
Using coffee-script 2.4.1
Using thor 0.19.1
Using railties 4.2.1
Using coffee-rails 4.1.0
Using diff-lcs 1.2.5
Using tilt 1.4.1
Using haml 4.0.6
Using multi_json 1.11.2
Using jbuilder 2.3.1
Using jquery-rails 4.0.4
Using bundler 1.7.12
Using sprockets 3.2.0
Using sprockets-rails 2.3.2
Using rails 4.2.1
Using rdoc 4.2.0
Using rspec-support 3.3.0
Using rspec-core 3.3.2
Using rspec-expectations 3.3.1
Using rspec-mocks 3.3.2
Using rspec-rails 3.3.3
Using sass 3.4.16
Using sass-rails 5.0.3
Using sdoc 0.4.1
Using spring 1.3.6
Using sqlite3 1.3.10
Using turbolinks 2.5.3
Using uglifier 2.7.1
Using web-console 2.2.1
Your bundle is complete!
Gems in the group production were not installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
When I run which ruby It'll show me the path /usr/local/bin/ruby and when I run bundle show minitest it'll show me /Library/Ruby/Gems/2.0.0/gems/minitest-5.8.0
Why is it not detecting that minitest is installed.
Try running rake db:migrate with bundle exec.
Your complete run command should be bundle exec rake db:migrate.
I would try reinstall your ruby
rvm get stable
rvm reinstall ruby-2.3.0

Bundle install foundation-icons-sass-rails 3

I'm having an issue with foundation-icons-sass-rails
When i bundle install, it installs without an issue.
$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Using rake 10.3.2
Using i18n 0.6.11
Using json 1.8.1
Using minitest 5.4.1
Using thread_safe 0.3.4
Using tzinfo 1.2.2
Using activesupport 4.1.4
Using builder 3.2.2
Using erubis 2.7.0
Using actionview 4.1.4
Using rack 1.5.2
Using rack-test 0.6.2
Using actionpack 4.1.4
Using mime-types 1.25.1
Using polyglot 0.3.5
Using treetop 1.4.15
Using mail 2.5.4
Using actionmailer 4.1.4
Using activemodel 4.1.4
Using arel 5.0.1.20140414130214
Using activerecord 4.1.4
Using bcrypt 3.1.7
Using coffee-script-source 1.8.0
Using execjs 2.2.1
Using coffee-script 2.3.0
Using thor 0.19.1
Using railties 4.1.4
Using coffee-rails 4.0.1
Using orm_adapter 0.5.0
Using warden 1.2.3
Using devise 3.3.0
Using sass 3.2.19
Using hike 1.2.3
Using multi_json 1.10.1
Using tilt 1.4.1
Using sprockets 2.11.0
Using sprockets-rails 2.1.4
Using sass-rails 4.0.3
Installing foundation-icons-sass-rails 3.0.0
Using foundation-rails 5.4.3.0
Using jquery-rails 3.1.2
Using kaminari 0.16.1
Using mysql2 0.3.16
Using polyamorous 1.1.0
Using bundler 1.6.2
Using rails 4.1.4
Using ransack 1.3.0
Using spring 1.1.3
Using sqlite3 1.3.9
Using turbolinks 2.3.0
Using uglifier 2.5.3
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
And this is the output from trying to start rails console
$ rails c
Could not find foundation-icons-sass-rails-3.0.0 in any of the sources
Run `bundle install` to install missing gems.
I'm using rvm with gemsets.
Ruby 2.1.2
I've tried deleting gemset and all gems, then re-installing etc. and nothing works. Any ideas on this would be amazing, this is killing me!
Thanks!
Try running bin/spring stop to force your application to re-initialize.

Rails says json 1.8.1 is missing even though its listed during bundle install

I did rails new awesomeapp then when I go to do rails s, I get an error that json-1.8.1 is missing. But when I do bundle install, it's clearly listed. What am I missing?
Donalds-MacBook-Pro:awesomeapp · rails s
Could not find json-1.8.1 in any of the sources
Run `bundle install` to install missing gems.
Donalds-MacBook-Pro:awesomeapp · bundle install
Using rake 10.3.2
Using i18n 0.6.9
Using json 1.8.1
Using minitest 5.3.5
Using thread_safe 0.3.4
Using tzinfo 1.2.1
Using activesupport 4.1.0
Using builder 3.2.2
Using erubis 2.7.0
Using actionview 4.1.0
Using rack 1.5.2
Using rack-test 0.6.2
Using actionpack 4.1.0
Using mime-types 1.25.1
Using polyglot 0.3.5
Using treetop 1.4.15
Using mail 2.5.4
Using actionmailer 4.1.0
Using activemodel 4.1.0
Using arel 5.0.1.20140414130214
Using activerecord 4.1.0
Using sass 3.3.9
Using bootstrap-sass 3.0.1.0
Using sassy-maps 0.4.0
Using breakpoint 2.4.2
Using chunky_png 1.3.1
Using coffee-script-source 1.7.0
Using execjs 2.2.1
Using coffee-script 2.2.0
Using thor 0.19.1
Using railties 4.1.0
Using coffee-rails 4.0.1
Using fssm 0.2.10
Using compass 0.12.2
Using hike 1.2.3
Using multi_json 1.10.1
Using tilt 1.4.1
Using sprockets 2.11.0
Using compass-rails 1.1.7
Using jbuilder 2.1.1
Using jquery-rails 3.1.1
Using normalize-rails 3.0.1
Using bundler 1.6.2
Using sprockets-rails 2.0.1
Using rails 4.1.0
Using rdoc 4.1.1
Using sass-rails 4.0.1
Using sdoc 0.4.0
Using spring 1.1.3
Using sqlite3 1.3.9
Using susy 2.1.0
Using turbolinks 2.2.2
Using uglifier 2.5.1
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
Donalds-MacBook-Pro:awesomeapp · rails s
Could not find json-1.8.1 in any of the sources
Run `bundle install` to install missing gems.
Donalds-MacBook-Pro:awesomeapp ·
I think that you need to update your bundler.
Try running:
bundle update
bundle install
rails s

Resources