This is probably very simple question.
Each time I do "Bundle install" in the folder of the project
I get an error like this
An error occured while installing json (1.6.6), and Bundler cannot continue.
Make sure that X succeeds before bundling.
where X can be
'gem install json -v '1.6.6'
or
'gem install execjs -v '1.3.2'
or
'gem install coffee-script -v '2.2.0'
Now, after I gradualy do each gem install manually the bundle install succeeds.
Is there a way to do them all in one command?
is there a way to do it in ruby mine?
That's what Bundler is supposed to do for you.
It looks like you have a problem with your Bundler or Ruby Install somewhere.
Without more information I can only suggest that you checkout the Bundler Troubleshooting page.
I've run into the same problem before if my network connection was an unstable/low bandwidth wireless connection. It tries to install all the gems at once, but stalls on one of them because of the lack of bandwidth. Then you can of course install one at a time maybe, but if your connection keeps going in and out this may be the cause of your inability to install them all at once.
It's possible that some of your gems aren't getting installed due to a bug related to using SSL connections. This would then mean that gems that depend on those gems throw an error like the one you experienced.
See: http://railsapps.github.com/openssl-certificate-verify-failed.html
That link has various workarounds, but the easiest is to replace this line:
source 'https://rubygems.org'
at the top of your Gemfile with this line:
source 'http://rubygems.org'
Related
I've seen this a million times, but my usual fixes and stackoverflow suggestions aren't working this time.
When I run bundle install, it fails at pg:
An error occurred while installing pg (1.2.3), and Bundler cannot
continue.
In the past, I've solved this by first running gem install bundler before running bundle install again. This time, no luck. Any suggestions?
Of course, the moment I post this I find a fix on another stackoverflow question.
This did the trick:
gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/latest/bin/pg_config
It's worth mentioning that you need to have Postgres installed on whatever machine you're trying to install the gem on for the gem to be installed.
It might be obvious to some, but not to others.
to verify that the actual problem is missing Postgres on the machine, the error should be somewhat similar to this:
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.
face the same issue and I've solved this by first installing brew install postgresql and running bundle install again
You're missing a couple of necessary system libraries. To install:
sudo apt install postgresql-contrib libpq-dev
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'm a Ruby novice working on a Rails application. We're trying to speed up our installs by running a local gem server instead of always going out to rubygems.org. I found that running the command:
gem server
sets this up, with the server running at localhost 8808. However when I add a source line for that URL to my Gemfile, and then run "bundle install", it fails after a minute or so saying:
Gem::RemoteFetcher::FetchError: bad response Not Found 404 (http://localhost:8808/gems/rake-10.3.1.gem)
An error occurred while installing rake (10.3.1), and Bundler cannot continue.
Make sure that `gem install rake -v '10.3.1'` succeeds before bundling.
If I browse to that server, I see a page saying that Rake, version 10.3.1 is installed, but when I go to the listed URL, I do get a 404 page. After running the gem install command, I still get a 404 page, but the bundle install gets a step further and fails with:
Gem::RemoteFetcher::FetchError: bad response Not Found 404 (http://localhost:8808/gems/activesupport-3.2.12.gem)
An error occurred while installing activesupport (3.2.12), and Bundler cannot continue.
Make sure that `gem install activesupport -v '3.2.12'` succeeds before bundling.
What's going on here? I have both source lines in my Gemfile, so I'd expect the bundler to go out to rubygems.org for anything it couldn't find locally, but it also seems like the gems are in fact installed locally already. Do I have to run individual installs on each gem dependency? I'm sure I'm doing something obviously wrong here, but I'm don't know what it is.
This is a decent walkthrough of a few situations you might encounter while setting up a gem server: http://guides.rubygems.org/run-your-own-gem-server/
This one isn't half-bad either, if you're looking to just use local versions of gems (though this technique doesn't set up a separate gem server): https://coderwall.com/p/tqdrhq
I try to install rails but I am faced to the following error.
Has somebody any idea how to resolve it ?
C:\Users\Utilisateur>gem -v
2.0.14
C:\Users\Utilisateur>gem install rails
ERROR: Could not find a valid gem 'rails' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - no such name (htt
ps://rubygems.org/latest_specs.4.8.gz)
C:\Users\Utilisateur>gem install rails --source http://rubygems.org
ERROR: Could not find a valid gem 'rails' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - no such name (htt
ps://rubygems.org/latest_specs.4.8.gz)
Unable to download data from http://rubygems.org/ - no such name (http
://rubygems.org/latest_specs.4.8.gz)
First try to update ruby gems.
gem update --system
The issue most likely is with your internet connection.
If you see this issue again, try
gem install rails --source http://rubygems.org
You can add the not https source permanently like this
gem sources -a http://rubygems.org
Do you want to add this insecure source? [yn]y
I want to give you one more tip:
Don't develop rails on windows. Ruby and rails and many gems are very UNIXy in their ways. Install virtualbox and ubuntu on a virtual machine and run you development for there.
You might have proxy in your system. So use sudo http_proxy=http://host:port gem install rails.
I had the same issue but I ran the "Start command prompt with Ruby" as an administrator and tried the gem install rails and it worked.
I had to run 'gem install' as root to get this to work. I.e. 'sudo', which is less than ideal.
I suspect 'gem' has very poor error reporting and doesn't communicate the real cause from a permissions issue deep down the stack.
In my country for some strange reason rubygems.org domain is blocked. So a vpn was the solution for me.
My problem was I had configured a proxy in my network connection as #theBuzzyCoder said, so I simply changed my connection and it worked, I could install my gem (sass in my case)
I am trying to run "bundle install". It tries to install linecache19 version 0.5.13 which is not yet released. I can't find the linecache19 gem in Gemfile. Its getting installed as a dependency of some other gem. I would like to know what linecache19 gem is used for and who requires it.
You can run gem dependency GEMNAME on each of the gems in your gemfile (and possibly on their dependencies) to see who is requiring linecache19 0.5.13.
Maybe someone else will know of a way to search the whole dependency tree in one go.