i am new to Ruby on rails and i have facing this problem during Rails installation. I have searched a lot and tried many solution which were available on stackoverflow but nothing work for me. Please help how can i get out of this problem..
I have had this problem before, and the reason you are getting this method, is because you are trying to download from an https website.
My guess is you are trying to install all the gems in your gemfile and bundle install didn't work. It would give you a message like
bundler cannot continue. Please make sure gem install samplegem succeeds
Change the following line in your gemfile
source 'https://rubygems.org'
to
source 'http://rubygems.org'
and run bundle
alternatively, you could do the following
gem install mysql2 -s http://rubygems.org
Either way, you should be able to install the gem.
Had you already installed mysql in your machine? The same experiencing happened with me. I was using a virtual environment and trying to install gem mysql2 but I forget that I haven't mysql in my "main" environment.
I ran the following and mysql2 installed successfully.
gem install mysql2 -s http://rubygems.org
But the problem remaied the same when re ran the "bundle install"
Related
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
I tried all methods of here.
But still, the same error occurs.
An error occurred while installing mysql2 (0.5.2), and Bundler cannot
continue.
Make sure that gem install mysql2 -v '0.5.2' --source 'https://rubygems.org/'
succeeds before bundling.
My spec is:
MacOS Mojave 10.14.1
Ruby 2.5.3p105
Mysql 8.0.12 with Homebrew
Gemfile:
gem "rails"
gem "mysql2", "0.5.2"
Could you kindly tell me a solution?
This is a very good post. I was facing the same issue using mac. What I ended up doing was the following.
I changed the permission for the Gemfile. I used chmod 755 Gemfile.
I used sudo bundle install. This allowed me to install all the gems in the Gemfile.
I did a rake db:create and rails server.
Got things working. Hope it fixes your issue too.
I had the same issue, when setting up a new machine.
Just running
brew install mysql
fixed the failing mysql gem installation for me.
Don't know if this will help, but I had imilar problems on Mac with MySQL twice. First time I just did a complete reinstall, I made sure there were no MySQL files left in the system. I think I followed this guide. The second time I read that it's an issue with symoblic links which I managed to fix with brew prune (I see that it might have been renamed to brew cleanup now - worth to check both).
I encountered a weird problem. In the Gemfile.lock, it states json (1.8.6).
Basically, I can use bundle install to install json-1.8.6.
However, it still threw the following error when I run rspec command.
Could not find json-1.8.6 in any of the sources
Run `bundle install` to install missing gems.
Bundler version 1.15.0
Ruby 2.3.3
Check your ruby source in gemfile should be: source 'https://rubygems.org'
or try adding the github path of the gem:
gem 'json', :git => 'https://github.com/flori/json.git'
Also try doing a bundle update.
If none of these work, please post your gemfile.
I have had similar problem recently and couldn't install one of the gems. I am not sure why, but I think it's because of the new Windows update (just a blind shot)
I have managed to repair it with reinstalling Ruby and devkit for it.
Good luck!
I have recently started to learn rails and had a lot of trouble installing the mysql2 gem. Finally gave managed to install the mysql gem and abandoned mysql2. I have just created my first app, which failed to a great a GEMFILE.lock. I SO'd this and ran the bundler update cmd.
It returned the following issue:
extconf failed, exit code 1 (same issue that prevented me from installing the mysql2 gem)
...
Make sure that 'gem install mysql2 -v '0.3.17'' succeeds before bundling
I then delete: C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/mysql2
However, I run bundler update again and the gem returns, producing the same error.
Please help!
Ah I have found the solution.
What I did was change the 'mysql2' in my GEMFILE to 'mysql' (the gem I am using for MySql-Ruby), which did the trick
Delete mysql2 from the Gemfile, add the mysql, then bundle install. Should work.
And overall, in Rails pretty much everything you want to do with gems will be by using bundler, not by installing single gems.
I got this error
Could not find mysql2-0.3.13 in any of the sources
Run `bundle install` to install missing gems.
I tried to gem install mysql2 but without luck, it didn't fix it. I'm using wampp server and copied the libmysql.ddl to the bin folder of ruby. I also tried adding the path to the gem install just like this.
gem install mysql2 --platform=ruby -- ‘-with-mysql-lib=”C:\wamp\bin\mysql\mysql5.5.24\lib” -with-mysql-include=”C:\wamp\bin\mysql\mysql5.5.24\include”‘
Any ideas on how to fix this? THanks!
First, make sure you have mysql installed on your machine.
If you have an Ubuntu distribution, try:
sudo apt-get install libmysql-ruby libmysqlclient-dev
then try to install the gem again.
I installed mysql2 from sources like this
# i experienced some troubles with mysql2 0.3.13 installing
gem fetch mysql2 -v 0.3.12
gem install mysql2-0.3.12.gem -- ' --with-mysql-include="c:\Program Files (x86)\MariaDB 5.5\include\mysql" --with-mysql-lib="c:\Program Files (x86)\MariaDB 5.5\lib" '
But after each Gemfile updating and bundle install, bundler is installing precompiled version of mysql2 gem and it's very annoying. After manual removing precompiled gem rails app started successfully
P.S. You also need installed Ruby DevKit.