I just imported a 5 years old rails project on my ubuntu 18.04 server. I downloaded all the requirements such as ruby 2.0.0 or rails 3.2.22 and all the gems.
At the moment I'm trying to run: rails app:update which gives me the following error (the same when I run rail s) :
/usr/local/rvm/rubies/ruby-2.0.0-p648/lib/ruby/site_ruby/2.0.0/bundler/runtime.rb:81:in `require': /usr/local/rvm/gems/ruby-2.0.0-p648/gems/coverband-5.1.0/lib/coverband.rb:83: syntax error, unexpected '.' (SyntaxError)
(Rake&.application&.top_level_tasks ...
^
from /usr/local/rvm/rubies/ruby-2.0.0-p648/lib/ruby/site_ruby/2.0.0/bundler/runtime.rb:81:in `block (2 levels) in require'
from /usr/local/rvm/rubies/ruby-2.0.0-p648/lib/ruby/site_ruby/2.0.0/bundler/runtime.rb:76:in `each'
from /usr/local/rvm/rubies/ruby-2.0.0-p648/lib/ruby/site_ruby/2.0.0/bundler/runtime.rb:76:in `block in require'
from /usr/local/rvm/rubies/ruby-2.0.0-p648/lib/ruby/site_ruby/2.0.0/bundler/runtime.rb:65:in `each'
from /usr/local/rvm/rubies/ruby-2.0.0-p648/lib/ruby/site_ruby/2.0.0/bundler/runtime.rb:65:in `require'
from /usr/local/rvm/rubies/ruby-2.0.0-p648/lib/ruby/site_ruby/2.0.0/bundler.rb:114:in `require'
from /home/ project/apps/current/config/application.rb:9:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.0.0-p648/gems/railties-3.2.22.5/lib/rails/commands.rb:53:in `require'
from /usr/local/rvm/gems/ruby-2.0.0-p648/gems/railties-3.2.22.5/lib/rails/commands.rb:53:in `block in <top (required)>'
from /usr/local/rvm/gems/ruby-2.0.0-p648/gems/railties-3.2.22.5/lib/rails/commands.rb:50:in `tap'
from /usr/local/rvm/gems/ruby-2.0.0-p648/gems/railties-3.2.22.5/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I also get an error when I try to run: rake migrate
rake aborted!
SyntaxError: /usr/local/rvm/gems/ruby-2.0.0-p648/gems/coverband-5.1.0/lib/coverb and.rb:83: syntax error, unexpected '.'
(Rake&.application&.top_level_tasks ...
^
/home/ project/apps/current/config/application.rb:9:in `<top (required)>'
/home/ project/apps/current/Rakefile:5:in `require'
/home/ project/apps/current/Rakefile:5:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.0.0-p648/bin/ruby_executable_hooks:22:in `eval'
/usr/local/rvm/gems/ruby-2.0.0-p648/bin/ruby_executable_hooks:22:in `<main>'
Thanks for your help!
The safe navigation operator (&.) was added in Ruby 2.3.0.
Some of the code that changed by running rails app:update uses it.
Hence you first need to upgrade your Ruby version to 2.3.0+.
Rails upgrades and Ruby version requirements
Related
I am working on a Ruby on Rails project. I have everything set up but when I am trying to start the server by doing "rails s" I am getting the following error:
/home/syed/Desktop/offerletter/vendor/bundle/ruby/2.2.0/gems/browser-5.1.0/lib/browser/browser.rb:9:in `require_relative': /home/syed/Desktop/offerletter/vendor/bundle/ruby/2.2.0/gems/browser-5.1.0/lib/browser/accept_language.rb:37: syntax error, unexpected '.' (SyntaxError)
code&.downcase
^
/home/syed/Desktop/offerletter/vendor/bundle/ruby/2.2.0/gems/browser-5.1.0/lib/browser/accept_language.rb:44: syntax error, unexpected '.'
region&.upcase
^
from /home/syed/Desktop/offerletter/vendor/bundle/ruby/2.2.0/gems/browser-5.1.0/lib/browser/browser.rb:9:in `<top (required)>'
from /home/syed/Desktop/offerletter/vendor/bundle/ruby/2.2.0/gems/browser-5.1.0/lib/browser.rb:3:in `require_relative'
from /home/syed/Desktop/offerletter/vendor/bundle/ruby/2.2.0/gems/browser-5.1.0/lib/browser.rb:3:in `<top (required)>'
from /usr/share/rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/bundler/runtime.rb:81:in `require'
from /usr/share/rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/bundler/runtime.rb:81:in `block (2 levels) in require'
from /usr/share/rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/bundler/runtime.rb:76:in `each'
from /usr/share/rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/bundler/runtime.rb:76:in `block in require'
from /usr/share/rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/bundler/runtime.rb:65:in `each'
from /usr/share/rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/bundler/runtime.rb:65:in `require'
from /usr/share/rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/bundler.rb:114:in `require'
from /home/syed/Desktop/offerletter/config/application.rb:9:in `<top (required)>'
from /home/syed/Desktop/offerletter/vendor/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:78:in `require'
from /home/syed/Desktop/offerletter/vendor/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:78:in `block in server'
from /home/syed/Desktop/offerletter/vendor/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /home/syed/Desktop/offerletter/vendor/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:75:in `server'
from /home/syed/Desktop/offerletter/vendor/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /home/syed/Desktop/offerletter/vendor/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Things thats I have tried:
bundle install
bundle update
1.Ubuntu version - 20.4 LTS
2.rails - 4.2.2 (have to maintain this version due to various reasons)
3.ruby - 2.2.2 (have to maintain this version due to various reasons)
Note: Please ask in comments section If you need any futher information from me to solve the issue.
Kindly please help.
The safe navigator (&.) was introduced in Ruby 2.3.0, and you're using Ruby 2.2.0.
Please use try method or upgrade the Ruby version to 2.3.0+ for using safe navigator.
If the version of Ruby you're forced to use is too old for the safe navigator (&.) you can go oldschool with
code.downcase if code
or use the try() method
I'm using Ubuntu 14.04 and I'm a beginner using Ruby on Rails
I recently installed rbenv, ruby 2.3.0 and rails 4.2.4 following the tutorial: https://gorails.com/setup/ubuntu/14.04
After installation, I ran ruby -v and rails -v and got the expected versions. So far so good. Then I ran rails s and I got:
rails server bin/rails:6: warning: already initialized constant APP_PATH error
To fix it I ran:
rake rails:update:bin following this StackOverflow question: rails server bin/rails:6: warning: already initialized constant APP_PATH error which resulted to a new error (I also removed Spring gem):
Gem::LoadError: You have already activated rake 10.4.2, but your Gemfile requires rake 10.5.0. Prepending `bundle exec` to your command may solve this.
/my-home-directory/my-ruby-on-rails-project/config/boot.rb:3:in `<top (required)>'
/my-home-directory/my-ruby-on-rails-project/config/application.rb:1:in `<top (required)>'
/my-home-directory/my-ruby-on-rails-project/Rakefile:4:in `<top (required)>'
LoadError: cannot load such file -- bundler/setup
/my-home-directory/my-ruby-on-rails-project/config/boot.rb:3:in `<top (required)>'
/my-home-directory/my-ruby-on-rails-project/config/application.rb:1:in `<top (required)>'
/my-home-directory/my-ruby-on-rails-project/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
I prepend 'bundle exec' and got the following error:
/my-home-directory/my-ruby-on-rails-project/.bundle/gems/nokogiri-1.6.7.2/lib/nokogiri.rb:29:in `require': libruby.so.2.2: cannot open shared object file: No such file or directory - /my-home-directory/my-ruby-on-rails-project/.bundle/gems/nokogiri-1.6.7.2/lib/nokogiri/nokogiri.so (LoadError)
from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/nokogiri-1.6.7.2/lib/nokogiri.rb:29:in `rescue in <top (required)>'
from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/nokogiri-1.6.7.2/lib/nokogiri.rb:25:in `<top (required)>'
from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/fog-1.23.0/lib/fog/xml.rb:1:in `require'
from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/fog-1.23.0/lib/fog/xml.rb:1:in `<top (required)>'
from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/fog-1.23.0/lib/fog.rb:11:in `require'
from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/fog-1.23.0/lib/fog.rb:11:in `<top (required)>'
from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/carrierwave-0.10.0/lib/carrierwave/storage/fog.rb:3:in `require'
from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/carrierwave-0.10.0/lib/carrierwave/storage/fog.rb:3:in `<top (required)>'
from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/carrierwave-0.10.0/lib/carrierwave/storage.rb:9:in `require'
from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/carrierwave-0.10.0/lib/carrierwave/storage.rb:9:in `<top (required)>'
from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/carrierwave-0.10.0/lib/carrierwave.rb:78:in `require'
from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/carrierwave-0.10.0/lib/carrierwave.rb:78:in `<top (required)>'
from /my-home-directory/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:77:in `require'
from /my-home-directory/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:77:in `block (2 levels) in require'
from /my-home-directory/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
from /my-home-directory/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require'
from /my-home-directory/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
from /my-home-directory/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
from /my-home-directory/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
from /my-home-directory/my-ruby-on-rails-project/config/application.rb:7:in `<top (required)>'
from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:78:in `require'
from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:78:in `block in server'
from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `server'
from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /my-home-directory/my-ruby-on-rails-project/.bundle/gems/railties-4.2.4/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:8:in `require'
from bin/rails:8:in `<main>'
Before installing rbenv, I was using RVM and I had the same errors popping around. I can't figure out what changes I've done when I started having these issues.
For the sake of my sanity, any help is very appreciated!
Thank you all!
A friend of mine just helped me and fixed this.
What he suggested:
Create a file .ruby-version in my project directory with one line: ruby-2.3.0 - This will make sure that we're not loading another nokogiri version
Remove the bundler by running: rm -rfv .bundle
Then run: bundle
Run: bundle exec rails s
Works like a charm.
I asked him why he thinks I had these issues and said: Hard to say, a messed up .bundle directory can do a lot of funky stuff.
I have just started learning Ruby on Rails. I installed all the related softwares and started exploring the same. When I try to start the default server in Rails (WEBrick), I am getting the following error.
C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.5/lib/action_view/helpers.rb:40:in `<module:Helpers>': uninitialized constant ActionView::Helpers::ActiveModelHelper (NameError)
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.5/lib/action_view/helpers.rb:4:in `<module:ActionView>'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.5/lib/action_view/helpers.rb:3:in `<top (required)>'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.5/lib/action_view/base.rb:5:in `require'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.5/lib/action_view/base.rb:5:in `<top (required)>'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/template.rb:7:in `<class:Template>'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/template.rb:6:in `<module:WebConsole>'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/template.rb:1:in `<top (required)>'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console.rb:12:in `require'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console.rb:12:in `<top (required)>'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web-console.rb:1:in `require'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web-console.rb:1:in `<top (required)>'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `require'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `each'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `block in require'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `each'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `require'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler.rb:134:in `require'
from C:/Temp/Rails-Project/Sites/simple_cms/config/application.rb:7:in `<top (required)>'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:78:in`require'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:78:in`block in server'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in`tap'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in`server'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:39:in`run_command!'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.5/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Upon research in SOF, found from the link and other link that the nokogiri needs to be updated in the Gemfile. I updated and executed the Bundle Install command. Even after that, its not working. Please suggest me the ways to fix it. FYI, I am using the latest versions of gems.
I also updated my Gemfile with
gem 'rack', '~> 1.6.0'
It did not work.
Install an older version of rails (4.0.0) because I think windows doesn't have stable version of rails > 4.0.
Change the version in gemfile.
I've installed the latest version of Sublime Text 3 and https://github.com/shuky19/sublime_debugger.
I've followed the instructions, however when I run the debugger, I get the following error:
/Users/sauron/.rvm/gems/ruby-2.1.4/gems/execjs-2.2.2/lib/execjs/runtimes.rb:65:in `from_environment': Node.js (V8) runtime is not available on this system (ExecJS::RuntimeUnavailable)
Everything works fine when I run 'rails s' directly on the command line.
Here's the console output. The stack trace gets triggered when I try to make a request to the server with my browser.
Started process command: bash -c "'/Users/sauron/Library/Application Support/Sublime Text 3/Packages/Ruby Debugger/ruby_executor.sh' 'rvm' True '-C/Users/sauron/git/sja' '-r/Users/sauron/Library/Application Support/Sublime Text 3/Packages/Ruby Debugger/sublime_debug_require.rb' '-rbundler/setup' '/Users/sauron/.rvm/gems/ruby-2.1.4/bin/rails' s"
Connecting...
----------------------------------------
------------Ruby Executor---------------
----------------------------------------
Method: RVM
Using ruby version: ruby 2.1.4p265 (2014-10-27 revision 48166) [x86_64-darwin13.0]
Located at: /Users/sauron/.rvm/rubies/ruby-2.1.4/bin/ruby
Ruby Arguments = -C/Users/sauron/git/sja -r/Users/sauron/Library/Application Support/Sublime Text 3/Packages/Ruby Debugger/sublime_debug_require.rb -rbundler/setup /Users/sauron/.rvm/gems/ruby-2.1.4/bin/rails s
Connected
/Users/sauron/.rvm/gems/ruby-2.1.4/gems/execjs-2.2.2/lib/execjs/runtimes.rb:65:in `from_environment': Node.js (V8) runtime is not available on this system (ExecJS::RuntimeUnavailable)
from /Users/sauron/.rvm/gems/ruby-2.1.4/gems/execjs-2.2.2/lib/execjs/runtimes.rb:50:in `autodetect'
from /Users/sauron/.rvm/gems/ruby-2.1.4/gems/execjs-2.2.2/lib/execjs.rb:5:in `<module:ExecJS>'
from /Users/sauron/.rvm/gems/ruby-2.1.4/gems/execjs-2.2.2/lib/execjs.rb:4:in `<top (required)>'
from /Users/sauron/.rvm/gems/ruby-2.1.4/gems/uglifier-2.7.0/lib/uglifier.rb:3:in `require'
from /Users/sauron/.rvm/gems/ruby-2.1.4/gems/uglifier-2.7.0/lib/uglifier.rb:3:in `<top (required)>'
from /Users/sauron/.rvm/gems/ruby-2.1.4#global/gems/bundler-1.7.6/lib/bundler/runtime.rb:76:in `require'
from /Users/sauron/.rvm/gems/ruby-2.1.4#global/gems/bundler-1.7.6/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /Users/sauron/.rvm/gems/ruby-2.1.4#global/gems/bundler-1.7.6/lib/bundler/runtime.rb:72:in `each'
from /Users/sauron/.rvm/gems/ruby-2.1.4#global/gems/bundler-1.7.6/lib/bundler/runtime.rb:72:in `block in require'
from /Users/sauron/.rvm/gems/ruby-2.1.4#global/gems/bundler-1.7.6/lib/bundler/runtime.rb:61:in `each'
from /Users/sauron/.rvm/gems/ruby-2.1.4#global/gems/bundler-1.7.6/lib/bundler/runtime.rb:61:in `require'
from /Users/sauron/.rvm/gems/ruby-2.1.4#global/gems/bundler-1.7.6/lib/bundler.rb:133:in `require'
from /Users/sauron/git/sja/config/application.rb:15:in `<top (required)>'
from /Users/sauron/.rvm/gems/ruby-2.1.4/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in `require'
from /Users/sauron/.rvm/gems/ruby-2.1.4/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in `block in server'
from /Users/sauron/.rvm/gems/ruby-2.1.4/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /Users/sauron/.rvm/gems/ruby-2.1.4/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `server'
from /Users/sauron/.rvm/gems/ruby-2.1.4/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /Users/sauron/.rvm/gems/ruby-2.1.4/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
from /Users/sauron/git/sja/bin/rails:8:in `require'
from /Users/sauron/git/sja/bin/rails:8:in `<top (required)>'
from /Users/sauron/.rvm/gems/ruby-2.1.4/gems/spring-1.2.0/lib/spring/client/rails.rb:27:in `load'
from /Users/sauron/.rvm/gems/ruby-2.1.4/gems/spring-1.2.0/lib/spring/client/rails.rb:27:in `call'
from /Users/sauron/.rvm/gems/ruby-2.1.4/gems/spring-1.2.0/lib/spring/client/command.rb:7:in `call'
from /Users/sauron/.rvm/gems/ruby-2.1.4/gems/spring-1.2.0/lib/spring/client.rb:26:in `run'
from /Users/sauron/.rvm/gems/ruby-2.1.4/gems/spring-1.2.0/bin/spring:48:in `<top (required)>'
from /Users/sauron/.rvm/gems/ruby-2.1.4/gems/spring-1.2.0/lib/spring/binstub.rb:11:in `load'
from /Users/sauron/.rvm/gems/ruby-2.1.4/gems/spring-1.2.0/lib/spring/binstub.rb:11:in `<top (required)>'
from /Users/sauron/git/sja/bin/spring:16:in `require'
from /Users/sauron/git/sja/bin/spring:16:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'
Debugger stopped
Looks like I found the answer with a bit of searching on Stack overflow.
See: https://stackoverflow.com/a/24020042/2091901
I'm guessing that the runtime scripts for Sublime Text 3 debugger in question sets the environment variables and has an incorrect reference to the location of node.
In short, I created the following symlink and all is good:
ln -s /usr/local/bin/node /usr/bin/node
Actually. This does not completely solve my problem. I now get this error when servicing a request:
Connected
/Users/sauron/.rvm/gems/ruby-2.1.4/bin/rails:19: syntax error, unexpected '=', expecting keyword_end
Last exception: #
/Users/sauron/.rvm/gems/ruby-2.1.4/bin/rails:23: syntax error, unexpected end-of-input, expecting keyword_end
I was doing One Month Rails's tutorial on Nitrous.io. At one point, some weird files appeared on my tree, and I deleted them. Everything stopped working.
I ran:
$ git add .
$ git checkout -f
and restored the tree.
BUT, when I ran:
$ rails server
I get:
action#first-project-48185:~/pinteresting$ rails server
-bash: rails: command not found
I also tried:
$ ruby -v #and got an older version, so I reinstalled it
$ rails -v
action#first-project-48185:~/pinteresting$ rails -v
-bash: rails: command not found
When I run:
$ ruby -v #on MAC terminal, I get the correct version
$ rails -v #on MAC terminal, I get the correct version
Interestingly, when I run:
$ rails server or $ rails server -p 4000
I get:
Franciscos-MacBook-Pro:pinteresting franciscomello$ rails server
/Library/Ruby/Gems/2.0.0/gems/sqlite3-1.3.8/lib/sqlite3.rb:6:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError)
and a bunch of other text below:
from /Library/Ruby/Gems/2.0.0/gems/sqlite3-1.3.8/lib/sqlite3.rb:6:in `rescue in <top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/sqlite3-1.3.8/lib/sqlite3.rb:2:in `<top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
from /Users/franciscomello/Desktop/pinteresting/config/application.rb:7:in `<top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:76:in `require'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:76:in `block in <top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Franciscos-MacBook-Pro:pinteresting franciscomello$ rails server -p 4000
/Library/Ruby/Gems/2.0.0/gems/sqlite3-1.3.8/lib/sqlite3.rb:6:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError)
from /Library/Ruby/Gems/2.0.0/gems/sqlite3-1.3.8/lib/sqlite3.rb:6:in `rescue in <top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/sqlite3-1.3.8/lib/sqlite3.rb:2:in `<top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
from /Users/franciscomello/Desktop/pinteresting/config/application.rb:7:in `<top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:76:in `require'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:76:in `block in <top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
What's frustrating is I was on my largest streak without any errors or bugs :(
Any ideas?
I can't tell why Rails is no longer working from those errors, but I would recommend reinstalling rails. Run the following command to reinstall Rails:
gem install rails
From here you should be able to run rails server.
You could also run bundle install within the project directory if your Gemfile includes other gems which need to be installed.