Rails Console fails to run - ruby-on-rails

rbenv ruby version: 2.6.6
rails version: 5.1.4
I am working within an older codebase (ruby: 2.6.6 | rails: 5.4.1). This is a codebase I work with daily. I had to download a new ruby version, through rbenv, for a separate repo and in doing so caused quite an issue in my dev environment for the older codebase.
My initial investigation of the issue that popped up led me to delete the rbenv ruby version I had for the older code base (2.6.6), re-install the ruby version, rehash then reinstall bundler.
Previously, I could just run rails command (rails c, rails s) to open the console or run the server. Now I am met with this error when trying to run a rails command:
rbenv: rails: command not found
The `rails' command exists in these Ruby versions:
2.3.1
When trying to open the rails console with the following commands, bundle exec rails console, bin/rails console, I am met with this error:
`preload': Spring only supports Rails >= 5.2.0 (RuntimeError)
After running bin/rails s, and opening the webpage, the console returns a 500 error:
Completed 500 Internal Server Error in 427ms (ActiveRecord: 0.9ms)
Error during failsafe response: couldn't find file 'ckeditor/init' with type 'application/javascript'

This isn't the exact answer to your question, but the workaround I did for the "Spring only supports Rails >= 5.2.0" was to just 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

Spring is troubling rails console to start

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.

Error running and deploying 'People' from NetGuru Rails 4.0.3

I am trying to run https://github.com/netguru/people but keep getting issues. When I push it to heroku i get errors, when I copied the files to my projects folder and run 'rails server' I get rails server
Your Ruby version is 2.1.1, but your Gemfile specified 2.0.0
I updated the ruby version in gem file but still run into issues.
Any help would be appreciated. Running Mac OSX Mavericks
I believe you've got your answer here https://github.com/netguru/people/issues/3
try to do:
gem install bundler rails
and then just do
bundle

Error with Rails Edge/4 `require': cannot load such file -- thread_safe

Following ths instructions here for getting an app running off Rails Edge to test Rails 4:
What is the best way to generate a Rails app using edge?
and
How to create Edge rails application?
But running into this error:
`require': cannot load such file -- thread_safe (LoadError)
Using the command:
rails new Edge --edge --skip-bundle --database=postgresql --skip-test-unit --skip-index-html
A checkout of Rails master bin dir is on my path.
I am using rbenv with ruby 1.9.3p327.
I have cleared all my installed gems out, just running bundler.
Rails 3.2.9 works fine on my system, have an app in active development.
Issue is not having the rails gems installed (when installing via rubygems, dependencies are automatically resolved.
See https://github.com/rails/rails/pull/8589
Need to go into the cloned rails dir and run "bundle install", which will pull in the necessary gems.

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.

Unable to start Rails server

The issue is when I try to start server with rails server command after successfully created Rails app by running rails new myapp -d=mysql. However, I cant get the server to start and it gives me the following error:
Could not find gem 'mysql2 (~> 0.2.6, runtime)' in any of the gem sources listed in your Gemfile. Run `bundle install` to install missing gems.
Then I run bundle install but could not happen.
I have installed:
Ruby 1.8.7
Rails 3.0.9 with mysql
RubyGems 1.8.7
I searched everywhere but nobody can solve my problem please help me with this issue as soon as possible. I am using Ubuntu 11.04.
Thanks in advance.
If your bundle install is saying everything is installed, try prefixing your rails command with
bundle exec rails server <other args here>
That will make sure you run the server in the context of the bundle (as defined by your Gemfile). If that fixes the problem for you, then you can either keep running the server using that command, or figure out what's wrong with your environment (might be a path issue, or you might have multiple versions of ruby or bundler installed and things aren't getting installed where you think they are)
i have reinstalled rails 4.2.4 using "gem install rails" command
and generated new project using rails new helloworld
"cd helloworld" and "rails server" would started my server.

Resources