can't start Rails server - bunch of errors - ruby-on-rails

I'm new on Ruby on Rails (actualy I'm new programming in general) and I tried to start a new server for my web app. I followed all the rules that were in the book, installed everything required (I hope I've installed it correctly), but it keeps giving me the following error:
My command ->
C:\Users\Júlia\work\demo>ruby bin/rails server
C:/Ruby30-x64/lib/ruby/3.0.0/pathname.rb:50:in `match?': invalid byte sequence in UTF-8 (ArgumentError)
from C:/Ruby30-x64/lib/ruby/3.0.0/pathname.rb:50:in `chop_basename'
from C:/Ruby30-x64/lib/ruby/3.0.0/pathname.rb:374:in `plus'
from C:/Ruby30-x64/lib/ruby/3.0.0/pathname.rb:354:in `+'
from C:/Ruby30-x64/lib/ruby/3.0.0/pathname.rb:420:in `join'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.28/lib/bundler/settings.rb:444:in `global_config_file'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.28/lib/bundler/settings.rb:93:in `initialize'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.28/lib/bundler.rb:330:in `new'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.28/lib/bundler.rb:330:in `settings'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.28/lib/bundler.rb:99:in `configured_bundle_path'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.28/lib/bundler.rb:95:in `bundle_path'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.28/lib/bundler.rb:639:in `configure_gem_home_and_path'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.28/lib/bundler.rb:81:in `configure'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.28/lib/bundler.rb:194:in `definition'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.28/lib/bundler.rb:143:in `setup'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.28/lib/bundler/setup.rb:10:in `block in <top (required)>'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.28/lib/bundler/ui/shell.rb:136:in `with_level'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.28/lib/bundler/ui/shell.rb:88:in `silence'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.28/lib/bundler/setup.rb:10:in `<top (required)>'
from <internal:C:/Ruby30-x64/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from <internal:C:/Ruby30-x64/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from C:/Users/Júlia/work/demo/config/boot.rb:3:in `<top (required)>'
from bin/rails:3:in `require_relative'
from bin/rails:3:in `<main>'
I'm so frustrated right now, I keep doing things apparently right but something always has to go wrong! Anyways, I hope someone will be able to help me here :(

You can follow GoRails guide to install RoR on windows it will be much easier.
Here it is: Install Ruby On Rails on Windows 10
Also after installing it you may face some other issues related to your database ( whatever database you use) like you may have installed Postgresql on windows, so when after installing it on WSL you need to kill the one running on the port that WSL will use, and similar issues, all solved across the internet

Related

I am unable to start the rails server [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
When I start the Rails server I get the following error:
$ rails s -p 8080
from /home/ccuser/.gem/ruby/2.0.0/gems/railties-4.1.1/lib/rails/commands.rb:17:in `<top (required)>'
from /home/ccuser/workspace/learn-rails_threadly/threadly/bin/rails:8:in `require'
from /home/ccuser/workspace/learn-rails_threadly/threadly/bin/rails:8:in `<top (required)>'
from /home/ccuser/.gem/ruby/2.0.0/gems/spring-1.3.6/lib/spring/client/rails.rb:28:in `load'
from /home/ccuser/.gem/ruby/2.0.0/gems/spring-1.3.6/lib/spring/client/rails.rb:28:in `call'
from /home/ccuser/.gem/ruby/2.0.0/gems/spring-1.3.6/lib/spring/client/command.rb:7:in `call'
from /home/ccuser/.gem/ruby/2.0.0/gems/spring-1.3.6/lib/spring/client.rb:26:in `run'
from /home/ccuser/.gem/ruby/2.0.0/gems/spring-1.3.6/bin/spring:48:in `<top (required)>'
from /home/ccuser/.gem/ruby/2.0.0/gems/spring-1.3.6/lib/spring/binstub.rb:11:in `load'
from /home/ccuser/.gem/ruby/2.0.0/gems/spring-1.3.6/lib/spring/binstub.rb:11:in `<top (required)>'
from /usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/ccuser/workspace/learn-rails_threadly/threadly/bin/spring:13:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'
What could be the problem?
As short hand, "rails s" starts the server as well as "rails server". The space inbetween is required. Also, I would also strongly suggest Rails development on non Windows platforms. A handful of gems are not compatible with windows versions, so loading a virtual machine with ubuntu will help you in the long run for sure.
I started with Rails development on Windows and instantly ran into trouble loading MySQL gems and others so I switched to Ubuntu 14.04 in a VM and it's been fantastic to say the least.
your command is wrong, It's rails server but not railsserver

Running vim-ruby-debugger on MacVim in OS X 10.10

Spent all day trying to make it works.
Installed like described in readme.
This shell call:
rdebug-vim --file /Users/aleksandrkunin/.vim/tmp/ruby_debugger --output /Users/aleksandrkunin/.vim/tmp/ruby_debugger_output --socket /var/folders/p9/dq06c2dn72nbbk45qdc5yx1h0000gp/T/vLSSici/17 --logger_file /Users/aleksandrkunin/.vim/tmp/ruby_debugger_log --debug_mode 0 --vim_executable mvim --vim_servername VIM --separator ++vim-ruby-debugger-separator++ -- '/Users/aleksandrkunin/Documents/rails_projects/tracks_dev/script/rails' server
Cause this error:
Users/aleksandrkunin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/debugger-xml-0.4.1/lib/byebug/commands/frame.rb:12:in `alias_method': undefined method `get_pr_arguments' for module `Byebug::FrameFunctions' (NameError)
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/debugger-xml-0.4.1/lib/byebug/commands/frame.rb:12:in `<module:FrameFunctions>'
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/debugger-xml-0.4.1/lib/byebug/commands/frame.rb:2:in `<module:Byebug>'
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/debugger-xml-0.4.1/lib/byebug/commands/frame.rb:1:in `<top (required)>'
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/debugger-xml-0.4.1/lib/debugger_xml.rb:5:in `block in <top (required)>'
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/debugger-xml-0.4.1/lib/debugger_xml.rb:5:in `each'
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/debugger-xml-0.4.1/lib/debugger_xml.rb:5:in `<top (required)>'
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/debugger-xml-0.4.1/bin/rdebug-vim:15:in `<top (required)>'
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/bin/rdebug-vim:23:in `load'
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/bin/rdebug-vim:23:in `<main>'
Is it possible to run? Is there another way for visual debugging in VIM?
I think the problem is that you're trying to use a gem that says it's for Ruby >= 1.9 with Ruby 2+.
rdebug does not work with Ruby 2.0+, only with Ruby in the 1.9 range. The documentation is confusing but that's how it is.
... This is a new version of the plugin, which uses debugger-xml gem, and works only with Ruby >= 1.9....
Look at the revision history of rdebug and you can see it hasn't been updated in a while.
With 2.1.1 you're using byebug, which doesn't implement the necessary call to work with Vim, hence the message:
undefined method `get_pr_arguments' for module `Byebug::FrameFunctions' (NameError)
Your choices are:
Revert to Ruby 1.9.3-p551, which is the latest of that series and install rdebug.
Stop trying to use vim-rdebug and learn to use byebug in its standalone mode, which is a more traditional debugger and works nicely. (Alternately you could use Pry and pry-debug.)

Webrick Rails server won't start?

I'm using Rails 4.0.0, and successfully installed the mysql2 gem yesterday (mysql-0.3.15) using mysql-connector-c-6.1.3.winx64. I created a new Rails project called "simple_cms" using rails new simple_cms -d mysql which worked, and then ran bundle install which was also fine.
When I try to run rails server I get the following errors:
C:\Users\Hans>cd sites
C:\Users\Hans\Sites>cd simple_cms
C:\Users\Hans\Sites\simple_cms>rails server
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.15/lib/mysql2.rb:8:in
`requir e': 126: The specified module could not be found. -
C:/Ruby200-x64/lib/ruby/ge
ms/2.0.0/extensions/x64-mingw32/2.0.0/mysql2-0.3.15/mysql2/mysql2.so
(LoadError)
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.15/lib/mysql2.rb :8:in `<top (required)>'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.0.rc2/lib/bundler/runtime.rb:76:in `require'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.0.rc2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.0.rc2/lib/bundler/runtime.rb:72:in `each'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.0.rc2/lib/bundler/runtime.rb:72:in `block in require'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.0.rc2/lib/bundler/runtime.rb:61:in `each'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.0.rc2/lib/bundler/runtime.rb:61:in `require'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.0.rc2/lib/bundler.rb:132:in `require'
from C:/Users/Hans/Sites/simple_cms/config/application.rb:7:in `<top (required)>'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:76:in `require'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:76:in `block in <top (required)>'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
from C:/Ruby200-x64/lib/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>'
C:\Users\Hans\Sites\simple_cms>
What can I do about this? By the way, the module it cannot find is in fact there.
28-Mar-2014 After all the problems I had installing and re-installing, I still could not get rails server to run. As I mainly want this installation to learn Ruby on Rails, I have instead installed the Bitnami Ruby stack, which installs everything automatically. This seems to work fine, and I've got Ruby, MySQL and the Apache Web Server working.
I had similar problems configuring the Lynda course on learning Ruby on Rails. I found an additional step that seemed to work for me. Since the error was complaining about the lack of a database in mysql, I created the missing database and that fixed the problem.
Log into mysql as root and prompt for password:
mysql -u root -p
Then:
SHOW DATABASES;
CREATE DATABASE simple_cms_development;
exit;

Ruby Gems dependency error

I am very very very new to RoR and I'm doing this on my windows 7 environment.
Yeah I know, "why not ubuntu?" We tried..performance was dog slow.
Anyway, I have RoR running on my machine and I created a test app aptly named, "testApp".
I run it in the browser..voila! No biggie. I have my basic website.
Now when I try and run it with a checked out website on my desktop, I get this
C:\devApp>ruby script/server
=> Booting WEBrick
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:in `requirement': undefined local variable or method `version_requirements' for
#<Rails::GemDependency:0x35eae38> (NameError)
from C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems.rb:254:in `activate'
from C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems.rb:1204:in `gem'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/rails/gem_dependency.rb:73:in `add_load_paths'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/initializer.rb:301:in `block in add_gem_load_paths'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/initializer.rb:301:in `each'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/initializer.rb:301:in `add_gem_load_paths'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/initializer.rb:132:in `process'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/initializer.rb:113:in `run'
from C:/srw/config/environment.rb:12:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `block in require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/commands/server.rb:84:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from script/server:3:in `<main>'
And no server is started. I've gone through all my gems to make sure I have the right versions as per my lead developer tells me. And we both are scratching our heads now.
Can someone help me figure out what dependency I'm missing?
Thanks!
I think this is happening because your RubyGems version is out of date. Try running gem update --system to update it to the latest version
Just update your bundler, maybe of any-one of the older gem is conflicting with latest one, this type of issues arises.
'gem install bundler'
and then 'bundler install'
If you find again error, then delete GEM.lock file, then run bundler install. It may resolve the issue.
Seems like you are trying to run an application without all the required gems, I would try installing all the gems that are mentioned in the "Gemfile" (root of the app), and running the application again.
As a Windows user, I would really suggest that you try to do your rails learning and development in Ubuntu (like I do). It is much easier to install, mantain, test applications and get help.

What’s wrong with my local Rails environment?

There is a Rails application I started a full year ago. It’s a Rails 2.3 app.
Now, someone else has made remote changes (it’s on Github, sorry, but it’s private). And I have done
sudo gem update
that is, updated all my gems, including Rails (to 3).
Realizing this, I have done
rake:freeze:edge RELEASE=2.3.8
or whatever to make this release use that version of rails, hoping this was the solution.
however, no such luck so far.
I get errors trying to start the server, AND trying to run script/console (though it’s more successful).
Note that this exact application works just fine on EngineYard.
Server:
$ script/server
=> Booting Mongrel
=> Rails 2.3.8 application starting on http://0.0.0.0:3000
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/yaml.rb:133:in `load': syntax error on line 45, col 3: `' (ArgumentError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/yaml.rb:133:in `load'
from /Users/ajh/Sites/PROJECT_NAME/config/../vendor/rails/railties/lib/initializer.rb:902:in `database_configuration'
from /Users/ajh/Sites/PROJECT_NAME/config/../vendor/rails/railties/lib/initializer.rb:437:in `initialize_database'
from /Users/ajh/Sites/PROJECT_NAME/config/../vendor/rails/railties/lib/initializer.rb:141:in `process'
from /Users/ajh/Sites/PROJECT_NAME/config/../vendor/rails/railties/lib/initializer.rb:113:in `send'
from /Users/ajh/Sites/PROJECT_NAME/config/../vendor/rails/railties/lib/initializer.rb:113:in `run'
from /Users/ajh/Sites/PROJECT_NAME/config/environment.rb:11
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
from /Users/ajh/Sites/PROJECT_NAME/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
from /Users/ajh/Sites/PROJECT_NAME/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /Users/ajh/Sites/PROJECT_NAME/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
from /Users/ajh/Sites/PROJECT_NAME/vendor/rails/railties/lib/commands/server.rb:84
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
from script/server:3
Console:
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/yaml.rb:133:in load':ArgumentError: syntax error on line 45, col 3:rai'
And when, in console, I try to use a defined model:
#mm = MyModel.find(:all)
NameError: uninitialized constant MyModel
from /Users/ajh/Sites/PROJECT_NAME/vendor/rails/activesupport/lib/active_support/dependencies.rb:443:in load_missing_constant'
from /Users/ajh/Sites/PROJECT_NAME/vendor/rails/activesupport/lib/active_support/dependencies.rb:80:inconst_missing'
from /Users/ajh/Sites/PROJECT_NAME/vendor/rails/activesupport/lib/active_support/dependencies.rb:92:in `const_missing'
from (irb):1
I just had this error, and the problem turned out to be that I'd used a tab instead of a double-space in the database.yml file. Thought I'd mention it, in case others have the same trouble.
My database.yml had a stray end keyword. Cleaning up that file solved my problems. Thanks to Garrett for pointing me in the right direction!

Resources