My "rails server" command not working properly and terminating unexpectedly - ruby-on-rails

Whenever i run my rails server command on my command prompt it gives me the following error:
Since i am new to the Rails, I don't know much about it.
Guide me with the solution if possible..
I am using rails 5 on windows OS

Specified 'mysql2' for database adapter, but the gem is not loaded. Add gem 'mysql2' to your Gemfile
As your error says please add mysql2 in your Gemfile
# Gemfile
gem 'mysql2'
Also make sure you have mysql installed

The answer to your question is in the error message. You're using mysql2 as your database adaptor, but the gem isn't available.
add:
gem 'mysql2'
to your gemfile, then run bundle update from your project folder to install the missing gem.

You need to add
gem 'mysql'
in your Gemfile.
If its added then run command bundle install to install it. And check whether its installed successfully or not then restart server.
Also check your gem version with your Rails version.

Related

I can't run rails server

how's going?
I trying to create my first application with Ruby on Rails, I can create the project but I can't run the server.
My OS is Windows.
I installed Node, Yarn, Ruby, Rails, Sqlite3.
This message appears when I try to run "rails s"
Could not find gem 'sqlite3' in locally installed gems.
Run `bundle install` to install missing gems.
I run the command "bundle install", "bundle update" and doesn't work. This message appears when I run "bundle install":
An error occurred while installing sqlite3 (1.4.2), and Bundler cannot continue.
In Gemfile:
sqlite3
When I verify the version of sqlite3:
enter image description here
I tried editing Gemfile:
gem 'sqlite3', '~> 1.4.2'
And tried install this way:
gem install sqlite3 -v '1.4.2' --source 'https://rubygems.org/'
I tried this steps too:
https://www.youtube.com/watch?v=cAseoJeNG8I
I follow the recommendation in the documentation for windows users and run "bin/rails s" on Bash, but still the same problem.
I read other answers here to similar questions but did not help me, for this I ask with this.
If something was a miss to you understand the problem please tell me and I provide the information.
Thanks, everyone.
The above Error occurred because sqlite3 is not installed on your system.
Step1:- First, install the sqlite3 on your system by following the steps mention here
Step2:- Run bundle install
Have you tried deleting gemfile.lock? Try delete and after that again type bundle install

Ruby on Rails - sqlite installation problems Windows7

I installed ruby (along with development kit) and then I installed rails using the command gem install rails.
I am looking to start a new rails project, however it is throwing an error, and asking to make sure that
gem install sqlite3 -v '1.4.0' --source 'https://rubygems.org/
succeeds before bundling.
I ran the above command, but I got an error as follows:
I am following these two links to start a rails project or on how to install SQLite in windows.
https://guides.rubyonrails.org/getting_started.html
https://skorks.com/2009/08/installing-and-using-sqlite-with-ruby-on-windows/
I also manually downloaded the sqlite files from the sqlite download page and copied them to C:/ruby/bin folder
Looking for a way to start a new project in rails with no sqlite3 issues.
Add the following line into your project Gemfile and bundle install again.
gem 'sqlite3', git: "https://github.com/larskanis/sqlite3-ruby", branch: "add-gemspec"
This will fix your problem.

use mysql in ror insted of sqlite3?

I want to use MySQL in ROR.
I add gem in my Gem file.
gem mysql2
and then I run a command
gem install mysql2
It gives me following error
"could not find a valid gem '0.3.13' <> =0> in any repository"
Please anybody tell me how can i use MySQL for ROR application
Thanks
I think your syntax in your Gemfile is missing quote marks:
gem 'mysql'
and then your commandline call to install it should instead be:
bundle install

How to solve the Gem::LoadError in Ruby on Rails?

I am new to Ruby, previously I installed an older Ruby and gem versions and I create one sample project.
Now I...
uninstall the Ruby and all using uninstall program via control panel.
install new versions of ruby and all.
run the server - it throws a lot of errors.
I solved some problems but I am not able to solve the Gem::LoadError and rake db:migrate errors.
Please help me. Thanks in advance.
Try to add gem sqlite3 into your Gemfile and then run bundle in console.
It should look something like this
Gemfile
source 'https://rubygems.org'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'

how can I go back to an error with bundle install that no start the application?

to load my rails 3.2.8 app on Heroku, I put in Gemfile:
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
and I gave 'bundle install', forgetting to give '-- without production' and now when I give 'rails s', the console gives me error: Could not find railties '..my gems..' (gem: load error) and Heroku gives me error when I give: heroku run rake db:migrate..In Gemfile I just put the gem 'sqlite3' and gave 'bundle install' but same error. How can I go back with bundle?
From your comment, it looks like you do not have bundler installed or at least accessible in this environment.
Are you using rvm ? If so are you in the right gemset with the right ruby version ?
You will have to fix your local environment before make it working on Heroku in order to have a proper Gemfile.lock, also when it will work on local, it should work fine on heroku.
If you do not use rvm / rbenv, maybe you can start by installing bundler properly : gem install bundler

Resources