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.
sudo apt-get remove ruby && sudo apt-get autoremove
\curl -sSL https://get.rvm.io | sudo bash -s stable --rails
\curl -sSL https://get.rvm.io | sudo bash -s stable --rails
sudo usermod -aG rvm USERNAME && sudo usermod -aG rvm www-data
bundle install
commandsudo apt-get install libmysqlclient-dev
.I've seen this solution while following a tutorial on this blog
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With