Spring is troubling rails console to start - ruby-on-rails

When i am trying to execute:
bundle exec rails console
It is throwing me error as:
/gems/spring-3.1.1/lib/spring/application.rb:96:in `preload': Spring only supports Rails >= 5.2.0 (RuntimeError)
Earlier it was working fine.
Can anyone help me with a workaround for this.

The workaround I did for this was to create a new project with rails 5.2.3 or something.
If you want to do the same, you can first list all your local gems by doing gem list rails --local
You will see all your rails versions installed locally.
Then do gem install rails -v '5.2.3'
Now go to a new project directory and run rails _5.2.3_ new appname
Now, you should be able to use the console, generate, migrate and other commands.
You can do bundle install after adding other relevant gems based on your apps requirement.

Related

copies a rails app to a new computer: rails command not found

I have just set up ruby and rails on a freshly installed freeBSD. It works great. I can do rails new blabla mv into blabla and do rails s and it just works.
I had an up and running rails app on another computer. I copied the repertory that contained the app to the new computer running freeBSD. However, when I mv into that repertory of the rails app and to rails server I get -bash: rails: command not found
I have tried creating a new app with the same name and let rails create all the repertories and then copy the files of the existing rails app therein but no success.
I can run rails -v and rails s from within any repertory and get correct answer, but when I move into that specific repertory I get that command not found.
You're probably using a ruby version manager I suspect (rbenv/rvm)? Check the ruby version in your Gemfile (top of the file). It probably isn't the same as the ruby version you have installed. If you're using one of the above mentioned version managers than install the correct ruby for your rails project. After that you can do a gem install bundler in the project directory and after run bundle install which will install rails and all dependencies.
Which version you are using? It happens with earlier versions. Try updating your gems and bundler. And try again. Hope it helps.
Did you try running bin/rails s? I think tha you need run bundle install too.

Why does this happen when i try to update rails to 4.0.0?

I pulled someone's project from github, and we seem to be using different rails versions. When i update the rails gem, it seems to go fine, but when i check the version it still shows the previous one and won't run the rails server.
me#ubuntu:~/Documents/RailsProjects/vega$ gem install rails
--version=4.0.0
Successfully installed rails-4.0.0
Parsing documentation for rails-4.0.0
Done installing documentation for rails after 0 seconds
1 gem installed
me#ubuntu:~/Documents/RailsProjects/vega$ rails -v
Rails 3.2.6
You have multiple Rails versions installed and it's reporting the first one it finds.
Does the project have a gemfile? If so just let bundle handle this for you:
bundle install
bundle exec rails s

'rails s' throwing error

I am configuring a Rails APP. I did bundle install properly. Also using ruby 1.8.7 using RVM. Now after bundle install, it is throwing the below given error while doing rails s.
/usr/local/lib/site_ruby/1.8/rubygems.rb:335:in `bin_path': can't find
executable rails for rails-3.2.9 (Gem::Exception)
Can anyone help me to sort out this?
Using ruby: 1.8.7
Rails Version: 3.0.3
After running bundle install, your Gemfile.lock has a list of all the gems and their versions that are needed.
However, you need to run bundle exec in order for bundler to make those gem versions available to you.
The rails script is an exception, as it invokes bundler for you, but it sounds like something isn't working in your environment.
Try executing the rails script using bundle exec like so:
bundle exec rails s
And see if that helps. Also, from the man who wrote bundler: http://yehudakatz.com/2011/05/30/gem-versioning-and-bundler-doing-it-right/
You have two rails gem versions in same gemset so it is picking latest version. So you need to specify rails version for rails commands.
Try this:
$ rails _3.0.3_ server

rails -v returns 2.3.5 but gem uninstall rails offers to uninstall version 3.1

I am trying upgrade Rails. I am pretty sure that Rails 3.1 is now installed, however my rails apps still have no Gemfile, and rails -v returns 2.3.5. When I type "gem uninstall rails" I get:
aheine#ubuntu:~/www$ gem uninstall rails
Select gem to uninstall:
1. rails-3.0.9
2. rails-3.1.0.rc1
3. rails-3.1.0.rc5
4. All versions
How can I get rid of Rails 2, and make rails 3 the default version to use?
I am using Ubuntu 11.04
Your running with the system provided Rails, run apt-get remove rails and then you may need to make a configuration change so the system can find the proper rails command. So see if that works and then try running rails -v if that returns command not found add this line to the beginning of your .bashrc file in your home directory.
export PATH=/var/lib/gems/1.8/bin:$PATH
After that's done open a new shell and try running rails -v again.

Could not locate Gemfile after executing "bundle install"

Hey,
I am completely new to Rails and just started created my first Project, following the Steps of a tutorial.
I created the new Project using: rails myapp.
Then I should execute bundle install, this did not work because bundler has not been installed, after an Update on Gems and installing bundler I have been able to execute bundle install, but every time I receive: Could not locate Gemfile
I checked my project dir, it is true there is no Gemfile, but should this be created automatically or not?
Thanks in advance
That depends on your version of rails. Since you simply write rails myapp I assume you do not use Rails 3, where you would write rails new myapp. In Rails 3, at least, the Gemfile is created for you automatically, and I would recommend using the latest version of Rails.

Resources