I know there are bunch of question or similar on the web, but it doesn't fit my case.
I'm installing redmine, and when I call bundle install, I get this error :
[!] There was an error parsing `Gemfile`: compile error - syntax error, unexpected ':', expecting $end
gem 'tzinfo-data', platforms: [:mingw, :x64_mingw, :mswin, :jruby]
^. Bundler cannot continue.
The error is on this line (the one prefixed by ->):
source 'https://rubygems.org'
if Gem::Version.new(Bundler::VERSION) < Gem::Version.new('1.5.0')
abort "Redmine requires Bundler 1.5.0 or higher (you're using #{Bundler::VERSION}).\nPlease update with 'gem update bundler'."
end
gem "rails", "4.2.3"
gem "jquery-rails", "~> 3.1.3"
gem "coderay", "~> 1.1.0"
gem "builder", ">= 3.0.4"
gem "request_store", "1.0.5"
gem "mime-types"
gem "protected_attributes"
gem "actionpack-action_caching"
gem "actionpack-xml_parser"
gem "loofah", "~> 2.0"
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
-> gem 'tzinfo-data', platforms: [:mingw, :x64_mingw, :mswin, :jruby]
gem "rbpdf", "~> 1.18.6"
# Optional gem for LDAP authentication
group :ldap do
gem "net-ldap", "~> 0.3.1"
end
like it's said in so many other threads, a cause could be that this code use the "new" ruby 1.9 hash syntax. However, looking at the versions:
$ ruby -v
ruby 2.1.5p273 (2014-11-13) [x86_64-linux-gnu]
$ gem -v
2.2.2
$ bundle -v
Bundler version 1.10.6
$ bundle exec ruby -v
ruby 2.1.5p273 (2014-11-13) [x86_64-linux-gnu]
$ which bundler
/usr/local/bin/bundler
EDIT: as suggested by Arsen, this command shows where is the problem, I'll read some documentations about ruby and virtual environments to get it work the right way :
$ bundle env
Environment
Bundler 1.10.6
Rubygems 1.8.24
Ruby 1.8.7 (2012-02-08 patchlevel 358) [x86_64-linux]
Git 2.5.1
Bundler settings
without
Set for your local app (/home/leo/http/redmine.leo-flaventin.com/redmine/.bundle/config): "development:test"
Gemfile
[...] #The redmine Gemfile
Then, I think gem is using ruby 2.2 (but I'm not sure) so I think there shouldn't be any problem, but since I don't really know the ruby universe and there is actually an error, I'm certainly wrong. That's why I request the help of the community...
So any ideas of what is going on ?
(I could correct the file using the old hash syntax, but since I would like to use the latest versions, I think that would only move the problem)
This is a old question but since it is unsolved and I ran into the same problem I'll share my solution.
I installed ruby via apt-get on my debian 7 server. When trying to run bundle install I got the same error message as above:
[!] There was an error parsing Gemfile: compile error - syntax
error, unexpected ':', expecting $end
My soultion was to install ruby via ruby version manager.
Remove ruby sudo apt-get remove ruby && sudo apt-get autoremove
Install ruby via ruby version manager (rvm) \curl -sSL https://get.rvm.io | sudo bash -s stable --rails
If 2. fails, add signature (as prompted) \curl -sSL https://get.rvm.io | sudo bash -s stable --rails
Add user to group sudo usermod -aG rvm USERNAME && sudo usermod -aG rvm www-data
Logout & login
Re-run your bundle install command
If you still have problems they should be application relevant. For me I additionally had to install sudo apt-get install libmysqlclient-dev.
I've seen this solution while following a tutorial on this blog
Try to add ruby "2.1.5" to Gemfile
Or just use rbenv
this worked for me when I got the same error installing a new app with rails 5:
gem install rails --version=5.0.0.1
bundle install
I do not know why it worked.
Related
bundler (2.0.1, default: 1.17.2)
How could I change the default to 2.0.1
Following https://bundler.io/guides/bundler_2_upgrade.html#upgrading-applications-from-bundler-1-to-bundler-2, here's what worked for me:
gem install --default bundler
gem update --system
bundle update --bundler
What helped me is to delete the current default manually from the folder
lib\ruby\gems\2.6.0\specifications\default\
and then install fresh bundler as usually
gem install bundler
or as default
gem install --default bundler
I had this same concern when trying to setup Bundler gem 2.2.11 as the default gem on my machine.
Here's how I achieved it:
First, I listed and uninstalled all other versions of the Bundler gem because I did not need them:
gem list bundler
gem uninstall bundler
If you encounter an error like this
Gem bundler-2.1.4 cannot be uninstalled because it is a default gem
Simply run the command below to get your ruby installation directory:
gem environment | grep "INSTALLATION DIRECTORY"
This should display an output like this. In my case my ruby version was 2.7.2:
- INSTALLATION DIRECTORY: /home/mycomputer/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0
Next, navigate to the specifications/default directory of the INSTALLATION PATH:
cd /home/mycomputer/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/specifications/default
Remove/delete the bundler.gemspec file that you have there. In my case it was bundler-2.1.4.gemspec, so I ran the command:
rm bundler-2.1.4.gemspec
Next, I installed the Bundler gem 2.2.11 and made it the default gem:
gem install --default bundler -v 2.2.11
Next, I listed my Bundler versions:
gem list bundler
Finally, I updated my gems to use the newly installed Bundler:
gem update --system
That's all.
I hope this helps
You need to remove .spec file to remove the gem.
Steps:
gem env – try to search in provided list under GEM PATHS, in specifications/default
remove there bundler-VERSION.gemspec
install bundler, if you don't have specific: gem install bundler:VERSION --default
gem install --default bundler:<version>
You need to know where the default specs are, so use gem environment to find out.
the steps I used were:
gem environment
# note INSTALLATION DIRECTORY
cd <installation_dir>
cd specifications/default
rm bundler-2.1.4.gemspec
gem install --default bundler -v 2.2.11
Remove all default bundler versions.
Commands:
$ gem environment
$ cd INSTALLATION DIRECTORY
$ cd specifications
$ cd default
$ rm bundler version
$ gem install bundler
I am trying to set up RedMine on Ubuntu 14.04.5 LTS machine and in the end of install have following error:
Redmine requires Bundler 1.5.0 or higher (you're using 1.3.5).
Please update with 'gem update bundler'. (SystemExit)
However, gem update bundlergives me following:
gem update bundler
Updating installed gems
Nothing to update
Moreover:
$ bundle -v
Bundler version 1.15.3
$ gem list | grep bundler
bundler (1.15.3)
I am totally stuck.
Could anybody tell me how to fix it?
I've tried to remove Bundler version check in Gemfile. Then I have following error:
`x64_mingw` is not a valid platform. The available options are: [:ruby, :ruby_18, :ruby_19, :ruby_20, :mri, :mri_18, :mri_19, :mri_20, :rbx, :jruby, :mswin, :mingw, :mingw_18, :mingw_19, :mingw_20] (Bundler::GemfileError)
I've checked solutions here: http://www.redmine.org/issues/19409 and here http://www.redmine.org/issues/19469 - nothing helps...
After this steps: Redmine installation : Error
I have cannot load such file -- bundler/setup (LoadError) error. But bundler is installed and still have version 1.15.3
Please help. I am totally disappointed with these errors.
Sorry for my english.
Try
bundle clean
to remove all bundled gems
Then
bundle install
to install required gems
Edit:
After seeing your new error, look at this answer:
'x64_mingw' is not a valid platform
And this RedMine board post:
http://www.redmine.org/boards/2/topics/45759
An updated bundler gem should be ok, but also check your Gemfile and remove any reference to x64_mingw before running bundle install
I just installed RVM, Ruby, Rails etc. on my virtual ubuntu 12.04 32bit running in a virtualbox. Now I encounter the problem that for my first rails project bundle install or bundle update takes very long time. Even when I create a new project with rails (which includes bundle install).
I use only the standard gems:
source 'https://rubygems.org'
gem 'rails', '3.2.12'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
group :development do
gem 'sqlite3', '1.3.5'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '3.2.5'
gem 'coffee-rails', '3.2.2'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '1.2.3'
end
gem 'jquery-rails', '2.0.2'
I tried bundle install without any gems but gem 'rails', '3.2.12'. After that I typed again bundle install with all gems in my gemfile. It took me 10 minutes to check for dependencies. The output of --verbose is a mix of HTTP success and HTTP redirection.
Rails version: Rails 3.2.12
Ruby version: ruby 1.9.3p392 (2013-02-22 revision 39386)
Rvm: rvm 1.18.18
bundle version: Bundler version 1.3.2
I already searched fot a solution, but nothing helped.
I want to warn: There is a security purpose for using https over http. Try at first the other answers mentioned in this thread.
Changing https to http in my Gemfile did the magic. Before I have to create the project with rails new APP --skip-bundle
Bundler just got an update of parallel processing of gems.
gem install bundler --pre
will solve the problem in the best possible way for now.
Source
You can also use multiple jobs, it may improve a little bit
bundle install --jobs 8
Here is a tutorial about it
Bundler v1.12.x was released in 2016 and caused some users to experience slow bundle install issues.
In this instance staying with v1.11.2 is the best option (it's fast) until a fix is released.
It's worth heading over to Rubygems.org to try different versions of the bundler gem.
Check existing bundler versions, uninstall existing version, install version 1.11.2 example:
gem list | grep bundler
gem uninstall bundler -v existing-version-number
gem install bundler -v 1.11.2
A developer friendly method is to override the gem server with a faster alternative.
In our case, we can configure http as a mirror to address slow https connections:
bundle config mirror.https://rubygems.org http://rubygems.org
This allows you to keep original Gemfile configuration while still using faster http connections to fetch gems.
If you wanted to switch back to https:
bundle config --delete mirror.https://rubygems.org
bundle config has a default --global option. You can specify --local to limit configurations to local application folder.
Configuration is saved into global ~/.bundle/config and local .bundle/config.
If you're still seeing this issue with Bundler 1.12.5, you may want to try updating the OpenSSL used by your Ruby.
For me this went like so:
pmorse$ bundle --version
Bundler version 1.12.5
pmorse$ ruby -ropenssl -e 'puts OpenSSL::OPENSSL_VERSION'
OpenSSL 1.0.1j 15 Oct 2014
pmorse$ openssl version
OpenSSL 0.9.8zg 14 July 2015
pmorse$ brew info openssl
openssl: stable 1.0.2h (bottled) [keg-only]
[... more brew output ...]
pmorse$ rvm reinstall ruby-2.2.2 --with-openssl-dir=`brew --prefix openssl`
[... lots of rvm output ...]
pmorse$ ruby -ropenssl -e 'puts OpenSSL::OPENSSL_VERSION'
OpenSSL 1.0.2h 3 May 2016
This should make bundle quicker again without requiring you to go from https to http.
I know this may be basic answer but try to install developer tools from the main Ruby site. I have had a similar problem and it did work. Sometimes simple solutions are the best!
Good luck!
First of all I've gone through dozens of posting here on SO and google and haven't been able to find an answer.
I'm trying to install mysql2 with bundler and it won't do it.
Running on Ubuntu Server 11.04 Natty
Here's some background info:
ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [x86_64-linux]
gem -v
1.8.24
rails -v
Rails 3.2.5
$ mysql --version
mysql Ver 14.14 Distrib 5.1.62, for debian-linux-gnu (x86_64) using readline 6.2
I have gem "mysql2", "~> 0.3.11" in my Gemfile
When I do bundle install it goes through the process and it finishes successfully (No Errors) but it doesn't install mysql2. When I do bundle show, mysql2 is not listed.
I've tried a gazillion of things recommended here and on forums and still can't get mysql2 to install with bundler.
Any ideas?
Thanks.
For mysql2 you need to install the dev files on your server.
try first:
sudo apt-get install libmysqlclient-dev
Then check first your GemFile in your RoR App Dir - I have this line in my GemFile:
gem 'mysql2', '0.3.11'
run bundle:
bundle install
or try the command from Emily first then run bundle install:
gem install mysql2 -v=0.3.11
bundle install
I hope it helps
So after many tries, reading, and pulling my hair out I found out what was the problem, so I'm posting it for those that might run into the same situation.
The reason why bundler wouldn't install mysql2 is because the gem was inside this platforms structure, see below:
platforms :mri_19, :mingw_19 do
group :mysql do
gem "mysql2", "0.3.11"
end
end
So all I did was to move just gem "mysql2", "0.3.11" by itself to the top of the Gemfile and run bundle install and that did it! Now mysql2 is listed under bundle show and my rails application is running now.
Thanks every one that tried to help!
After upgrading to Rails 3.0 Library rmagick longer be detected. Here is my setup:
Ubuntu server 10.4
gem 1.7.2
ruby 1.9.1
rails 3.0.7
rmagick-2.13.1
In irb can include library:
irb(main):002:0> require 'RMagick'
=> true
In rails 2 rmagick is available.
add
gem 'RMagick'
or
gem "rmagick", "~> 2.13.1"
to your Gemfile and then run
bundle
install
apt-get install libmagick9-dev
first
For those using Heroku:
gem "rmagick", "~>2.13.2", :require => 'RMagick'
Also, include the following wherever you're using it:
require 'RMagick'
For anyone reading this now, I was having issues installing libmagick9-dev(it appears to have been replaced).
I ran the following and it installed successfully:
sudo apt-get install libmagickcore-dev
sudo apt-get install graphicsmagick-libmagick-dev-compat
sudo apt-get install libmagickwand-dev
sudo apt-get install imagemagick
gem install rmagick
Cheers
When running bundle for an application like Redmine, gem might be optional, so you must include it like:
bundle install --with rmagick
Considering that it exists in your Gemfile, it should look something
like:
group :rmagick do
gem "rmagick", "~> 2.16.0"
end