Every time I run "make rails" I get syntax errors and warnings within my terminal.
I'm using ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-darwin18.0] because the project I'm working on mandates it, but I can update if needed.
We are currently using a legacy rails site as one of the users in the comments pointed out. This led to the find that we are our project would need to be run on ruby 2.3.0 as SOLR doesn't support the newer versions in our project. Furthermore, running bundle install also helps to resolve dependencies of older projects.
This is what I get when I make rails:
Ahans-MacBook-Pro:app ahansabharwal$ make rails
POSTGRES starting
pg_ctl -D ./db/development.pg -l ./db/development.pg/postgres.log start
waiting for server to start.... done
server started
Connection to localhost port 5432 [tcp/postgresql] succeeded!
SOLR starting
bundle exec rake sunspot:solr:start
/Users/ahansabharwal/.rvm/gems/ruby-2.1.3#project/gems/sass-3.7.2/lib/sass/script/functions.rb:2097: warning: else without rescue is useless
/Users/ahansabharwal/.rvm/gems/ruby-2.1.3#project/gems/sass-3.7.2/lib/sass/script/functions.rb:2103: warning: else without rescue is useless
/Users/ahansabharwal/.rvm/gems/ruby-2.1.3#project/gems/sass-3.7.2/lib/sass/script/functions.rb:2142: warning: else without rescue is useless
rake aborted!
SyntaxError: /Users/ahansabharwal/.rvm/gems/ruby-2.1.3#project/gems/sass-3.7.2/lib/sass/script/functions.rb:2093: syntax error, unexpected modifier_if
if separator.value == 'auto'
^
/Users/ahansabharwal/.rvm/gems/ruby-2.1.3#project/gems/sass-3.7.2/lib/sass/script/functions.rb:2097: syntax error, unexpected ',', expecting keyword_end
/Users/ahansabharwal/.rvm/gems/ruby-2.1.3#project/gems/sass-3.7.2/lib/sass/script/functions.rb:2103: syntax error, unexpected ')', expecting keyword_end
/Users/ahansabharwal/.rvm/gems/ruby-2.1.3#project/gems/sass-3.7.2/lib/sass/script/functions.rb:2138: syntax error, unexpected modifier_if
if separator.value == 'auto'
^
/Users/ahansabharwal/.rvm/gems/ruby-2.1.3#project/gems/sass-3.7.2/lib/sass/script/functions.rb:2142: syntax error, unexpected ')', expecting keyword_end
/Users/ahansabharwal/.rvm/gems/ruby-2.1.3#project/gems/sass-3.7.2/lib/sass/script/functions.rb:2920: syntax error, unexpected keyword_end, expecting end-of-input
.
. (similar syntax errors)
.
(See full trace by running task with --trace)
make[1]: *** [solr-force-start] Error 1
make: *** [solr] Error 2
Solved this issue by installing ruby 2.3.0, older versions aren't supported by SOLR. (2.6.0 onwards is not currently supported in our project)
Related
I am very new to Ruby and trying to run a script ,When I am trying to run a Ruby script like below, I am getting
> ruby test.rb
test.rb:53: syntax error, unexpected ':', expecting ')'
All::Config.new_global_config(domain: domain, realm: realm)
^
test.rb:53: syntax error, unexpected ':', expecting '='
All::Config.new_global_config(domain: domain, realm: realm)
When I see ruby version, it says:
> ruby -version
ruby 1.8.7 (2012-02-08 patchlevel 358) [x86_64-linux]
-e:1: undefined local variable or method `rsion' for main:Object (NameError)
Any pointers? Is it because of the version? 1.8.x instead of 1.9 or more?
The {key: 'value'} syntax was added in ruby v1.9. To do this in v1.8, you need to use the {:key => 'value'} syntax (which is still valid in modern ruby, too).
1.8 and 1.9 are both very old versions!!! Neither has been supported for a long time. (1.8 was retired in 2013; 1.9 in 2015.)
The latest version, at the time of writing this, is 2.4.1. Use this if possible.
The oldest supported version of ruby is 2.2.7.
Whenever I try to create a migration, I get the following error. Does anyone know what could be causing this?
$ rails generate migration NewMigration
/Users/myuser/.rvm/gems/ruby-2.1.4/bin/ruby_executable_hooks:15:in `eval': /Users/myuser/.rvm/gems/ruby-2.1.4/bin/rails:19: syntax error, unexpected '=', expecting keyword_end (SyntaxError) /Users/myuser/.rvm/gems/ruby 2.1.4/bin/rails:23: syntax error, unexpected end-of-input, expecting keyword_end
from /Users/myuser/.rvm/gems/ruby-2.1.4/bin/ruby_executable_hooks:15:in `<main>'
Somehow your bin/rails file got modified. Run gem pristine -a in the same rvm you were using before. This rebuilds / reinstalls all your gem files.
Hi I did the installation until “rake bootstrap RAILS_ENV=development” line. After that I get this error
WARNING: Sinatra 1.2.x has reached its EOL. Please upgrade. rake aborted! (eval):1: invalid multibyte char (UTF-8) (eval):1: invalid multibyte char (UTF-8) (eval):1: syntax error, unexpected end-of-input /[a-zA-Z][a-zA-Z0-9_-�-�]{0,24}/
^
/home/canercak/.bundler/ruby/2.0.0/mongoidext-ea4337c5aebe/lib/mongoidext.rb:8:in '
/home/canercak/dev/shapado/config/application.rb:16:in‘ /home/canercak/dev/shapado/Rakefile:4:in `’ (See full trace by running task with —trace)
I have ubuntu 13 runnig in US-EN settings. I used magic_encoding to add “# –– encoding : utf-8 ––” on top of every file but still get the error.
Any help would be greatly appreciated
I've sorted it out by changing rvm version to 1.9ç.3 and reinstalling the app
I used
rvm 1.8.7 do gem install sproutcore
It was installed successfully, but now on running sproutcore gen project getting_started
it gives me the following errors:
/Users/user/.rvm/gems/ruby-1.8.7-p370/gems/sproutcore-1.8.2.1/vendor/chance/lib/chance/instance/slicing.rb:22: syntax error, unexpected ':', expecting '}'
mtime: file[:mtime],
^
/Users/user/.rvm/gems/ruby-1.8.7-p370/gems/sproutcore-1.8.2.1/vendor/chance/lib/chance/instance/slicing.rb:23: syntax error, unexpected ':', expecting '='
canvas: canvas
^
/Users/user/.rvm/gems/ruby-1.8.7-p370/gems/sproutcore-1.8.2.1/vendor/chance/lib/chance/instance/slicing.rb:234: syntax error, unexpected $end, expecting kEND
I think this is a "known bug" with Ruby 1.8.7 as it's using some syntax that is only available in 1.9.
You should probably try upgrading to Ruby 1.9.2 or 1.9.3 which should fix the issue.
I agree with Topher Fangio, but to add how: this is what I did.
gem update --system
I have an application I am upgrading to 3.1 from Rails 3.0.9. But, I am getting a syntax error or something. It reads:
SyntaxError in BooksController#index
c:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/attribute_methods/read.rb:91: syntax error, unexpected keyword_end
c:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/attribute_methods/read.rb:93: syntax error, unexpected $end, expecting keyword_end
Rails.root: c:/Users/Travis/My Documents/Aptana Studio 3 Workspace/clicknslide
Application Trace | Framework Trace | Full Trace
app/models/user.rb:11:in `admin?'
app/models/ability.rb:8:in `initialize'
Any ideas?
Note:
All controllers worked fine in 3.0.9
Just upgrade to latest version of mysql2 gem. In my case it is 0.3.7 now.
It has nothing to do with CanCan. It is most likely MySQL2 if using Windows...have fun trying to update.