When I run rails s on cmd(windows) I got this error below... Can anyone hack this error?
I'm using thin gem for local dev environment. What do I need to chage?
C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/application/config
uration.rb:115:in `read': No such file or directory - C:/Sites/project/config/da
tabase.yml (Errno::ENOENT)
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/appli
cation/configuration.rb:115:in `database_configuration'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.11/lib/active_
record/railtie.rb:78:in `block (2 levels) in <class:Railtie>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/comma
nds.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Yes, the file C:/Sites/project/config/database.yml doesn't exist. Either move your database.yml to that location, or find the code that expects database.yml to be in that location and change it to point to where the file actually is.
Related
I made some changes in the Gemfile but I wanted to keep track of what was in the previous one. So I just changed the old one to Gemfile.old expectind it would be ignored. But after some changes and running bundle the rails server simply stopped running due to not finding this file.
here is the log.
/Users/viniciusbolzani/.rvm/gems/ruby-2.1.5#global/gems/bundler-1.7.11/lib/bundler/definition.rb:22:in `build': /Users/viniciusbolzani/work/cart/Gemfile.old not found (Bundler::GemfileNotFound)
from /Users/viniciusbolzani/.rvm/gems/ruby-2.1.5#global/gems/bundler-1.7.11/lib/bundler.rb:155:in `definition'
from /Users/viniciusbolzani/.rvm/gems/ruby-2.1.5#global/gems/bundler-1.7.11/lib/bundler.rb:118:in `setup'
from /Users/viniciusbolzani/.rvm/gems/ruby-2.1.5#global/gems/bundler-1.7.11/lib/bundler.rb:134:in `require'
from /Users/viniciusbolzani/work/cart/config/application.rb:7:in `<top (required)>'
from /Users/viniciusbolzani/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:121:in `require'
from /Users/viniciusbolzani/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:121:in `require'
from /Users/viniciusbolzani/.rvm/gems/ruby-2.1.5/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in `block in server'
from /Users/viniciusbolzani/.rvm/gems/ruby-2.1.5/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /Users/viniciusbolzani/.rvm/gems/ruby-2.1.5/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `server'
from /Users/viniciusbolzani/.rvm/gems/ruby-2.1.5/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /Users/viniciusbolzani/.rvm/gems/ruby-2.1.5/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
from /Users/viniciusbolzani/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:128:in `require'
from /Users/viniciusbolzani/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
from /Users/viniciusbolzani/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:39:in `require'
from /Users/viniciusbolzani/work/cart/bin/rails:8:in `<top (required)>'
from /Users/viniciusbolzani/.rvm/gems/ruby-2.1.5/gems/spring-1.2.0/lib/spring/client/rails.rb:27:in `load'
from /Users/viniciusbolzani/.rvm/gems/ruby-2.1.5/gems/spring-1.2.0/lib/spring/client/rails.rb:27:in `call'
from /Users/viniciusbolzani/.rvm/gems/ruby-2.1.5/gems/spring-1.2.0/lib/spring/client/command.rb:7:in `call'
from /Users/viniciusbolzani/.rvm/gems/ruby-2.1.5/gems/spring-1.2.0/lib/spring/client.rb:26:in `run'
from /Users/viniciusbolzani/.rvm/gems/ruby-2.1.5/gems/spring-1.2.0/bin/spring:48:in `<top (required)>'
from /Users/viniciusbolzani/.rvm/gems/ruby-2.1.5/gems/spring-1.2.0/lib/spring/binstub.rb:11:in `load'
from /Users/viniciusbolzani/.rvm/gems/ruby-2.1.5/gems/spring-1.2.0/lib/spring/binstub.rb:11:in `<top (required)>'
from /Users/viniciusbolzani/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/viniciusbolzani/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/viniciusbolzani/work/cart/bin/spring:16:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'
Does anyone have a clue why Rails would be identifying that extension as a real file and requiring it?
I really think there is something wrong with your configuration.
Inside the bin directory inside your application there are a few executable files that specify how the Gemfile filename should be handled. The default file name is Gemfile but it may have been changed somehow.
I would suggest you execute
grep -R -i -n 'Gemfile.old' *
on the root of your application and check if there are any references somewhere with this name. And if that's the case change it accordingly.
There isn't any need to store the old version of Gemfile as rails considers all the gems mentioned in the file named as Gemfile , you can use versioning tools like github or bitbucket for this purpose .
Every time you add a new gem , the Gemfile.lock file adds the gem name and version to it just to make sure that it knows about the last change you made . In cases such as these , where you intend to keep multiple files of the same name , it might end up creating more confusion .Also the Gemfile.lock stores all the versions of the gem used so that you have an idea what all version numbers were used .
When trying to run rails server command from the command line I get the following error. The first line seems the most pertinent, as the ones that follow appear to be errors due to the LoadError. However, I'm not really sure.
J:\Github\rails\genepool>rails server
J:/Ruby21/lib/ruby/gems/2.1.0/gems/sqlite3-1.3.9-x64-mingw32/lib/sqlite3.rb:6:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError)
from J:/Ruby21/lib/ruby/gems/2.1.0/gems/sqlite3-1.3.9-x64-mingw32/lib/sqlite3.rb:6:in `rescue in <top (required)>'
from J:/Ruby21/lib/ruby/gems/2.1.0/gems/sqlite3-1.3.9-x64-mingw32/lib/sqlite3.rb:2:in `<top (required)>'
from J:/Ruby21/lib/ruby/gems/2.1.0/gems/bundler-1.7.3/lib/bundler/runtime.rb:76:in `require'
from J:/Ruby21/lib/ruby/gems/2.1.0/gems/bundler-1.7.3/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from J:/Ruby21/lib/ruby/gems/2.1.0/gems/bundler-1.7.3/lib/bundler/runtime.rb:72:in `each'
from J:/Ruby21/lib/ruby/gems/2.1.0/gems/bundler-1.7.3/lib/bundler/runtime.rb:72:in `block in require'
from J:/Ruby21/lib/ruby/gems/2.1.0/gems/bundler-1.7.3/lib/bundler/runtime.rb:61:in `each'
from J:/Ruby21/lib/ruby/gems/2.1.0/gems/bundler-1.7.3/lib/bundler/runtime.rb:61:in `require'
from J:/Ruby21/lib/ruby/gems/2.1.0/gems/bundler-1.7.3/lib/bundler.rb:133:in `require'
from J:/Github/rails/genepool/config/application.rb:7:in `<top (required)>'
from J:/Ruby21/lib/ruby/gems/2.1.0/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:79:in `require'
from J:/Ruby21/lib/ruby/gems/2.1.0/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:79:in `block in server'
from J:/Ruby21/lib/ruby/gems/2.1.0/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:76:in `tap'
from J:/Ruby21/lib/ruby/gems/2.1.0/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:76:in `server'
from J:/Ruby21/lib/ruby/gems/2.1.0/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from J:/Ruby21/lib/ruby/gems/2.1.0/gems/railties-4.1.5/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
I have Sqlite3 installed to my Ruby root folder (Ruby21/sqlite). I've also got the Sqlite3 gem installed and the installation returns no errors. I can run sqlite from the command prompt. This is the same way I've got it installed on my laptop, which works fine so I'm really at a loss here. Any help appreciated.
This issue is resolved on this link. You basically have to change the require path from
s.require_paths=["lib"]
to
s.require_paths= ["lib/sqlite3_native"]
You can find it in your sqlite3 gemspec file. One example is /usr/local/share/gem/specifications/sqlite3-1.3.7.gemspec or 'C:\Ruby21\lib\ruby\gems\2.1.0\specifications'.
i'm trying to move my rails app from ubuntu to osx. when running rspec, i get the following obscure error:
/Users/josh/dev/myproject/spec/support/devise.rb:3:in `block in <top (required)>': uninitialized constant RequestHelpers (NameError)
from /Users/josh/.rvm/gems/ruby-1.9.3-p286#myproject/gems/rspec-core-2.11.1/lib/rspec/core.rb:92:in `configure'
from /Users/josh/dev/myproject/spec/support/devise.rb:1:in `<top (required)>'
from /Users/josh/dev/myproject/spec/spec_helper.rb:21:in `block (2 levels) in <top (required)>'
from /Users/josh/dev/myproject/spec/spec_helper.rb:21:in `each'
from /Users/josh/dev/myproject/spec/spec_helper.rb:21:in `block in <top (required)>'
from /Users/josh/.rvm/gems/ruby-1.9.3-p286#myproject/gems/spork-0.9.2/lib/spork.rb:24:in `prefork'
from /Users/josh/dev/myproject/spec/spec_helper.rb:4:in `<top (required)>'
from /Users/josh/dev/myproject/spec/controllers/comments_controller_spec.rb:1:in `require'
from /Users/josh/dev/myproject/spec/controllers/comments_controller_spec.rb:1:in `<top (required)>'
from /Users/josh/.rvm/gems/ruby-1.9.3-p286#myproject/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load'
from /Users/josh/.rvm/gems/ruby-1.9.3-p286#myproject/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `block in load_spec_files'
from /Users/josh/.rvm/gems/ruby-1.9.3-p286#myproject/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `map'
from /Users/josh/.rvm/gems/ruby-1.9.3-p286#myproject/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load_spec_files'
from /Users/josh/.rvm/gems/ruby-1.9.3-p286#myproject/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:22:in `run'
from /Users/josh/.rvm/gems/ruby-1.9.3-p286#myproject/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:66:in `rescue in run'
from /Users/josh/.rvm/gems/ruby-1.9.3-p286#myproject/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:62:in `run'
from /Users/josh/.rvm/gems/ruby-1.9.3-p286#myproject/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:8:in `block in autorun'
everything works nicely in Ubuntu, so i guess it must be environmental. Any ideas where to start digging?
thanks
- Josh
EDIT: no idea why, but the file request_helpers.rb could not be found by rake. moving it elsewhere resolved the issue.
This hardly seems an operating system problem, much rather a matter of configuration. Make sure your environemnt is the same in terms of:
using rvm installed the same way
having all the needed gems in the Gemfile
using bundle to execute rspec
using the same version of everything.
By te way this is not an obscure message, it's in fact pretty clear:
uninitialized constant RequestHelpers (NameError)
so the spec/support/devise.rb file can't find the needed class.
Have you written that file? If not, how did you generate it? Repeat the procedure to generate it (probably rake something or rails generate something) and it will be OK.
Hey guys,
I clone a repo in Github: https://github.com/huacnlee/homeland/tree/
when I run the server, I got this error:
Agro:homeland Zhulin$ rails s
DEPRECATION WARNING: railtie_name is deprecated and has no effect. (called from <top (required)> at /Users/Zhulin/Desktop/RailsApps/homeland/config/application.rb:9)
/usr/local/lib/ruby/1.9.1/syck.rb:145:in `initialize': No such file or directory - /Users/Zhulin/Desktop/RailsApps/homeland/config/config.yml (Errno::ENOENT)
from /usr/local/lib/ruby/1.9.1/syck.rb:145:in `open'
from /usr/local/lib/ruby/1.9.1/syck.rb:145:in `load_file'
from /Users/Zhulin/Desktop/RailsApps/homeland/config/application.rb:48:in `<top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/commands.rb:28:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/commands.rb:28:in `block in <top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/commands.rb:27:in `tap'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
What should I do? And BTW where can I find simpler Rails code for learning Ruby and Rails,
Thanks
You need to set up a config.yml file in the config folder. It looks like the repo includes a config.yml.default file that you can use as a template.
It looks like you're missing your database configuration file config/database.yml for some reason. These are generated automatically by rails new <appname> so it is easy to get a replacement.
As for examples, a good reference book is always best. I like the Agile Web Development with Rails book, but there are many others.
I just started learning ruby on rails with "Lynda Ruby on Rails 3 Essential Training".
I finished the installation, and created rails application by writing- "rails new app".
After that when I wrote - "rails server", that's what I saw:
C:\Users\Oded\sites\simple_cms>rails server
C:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6-x86-mingw32/lib/mysql2/mysql2.r
b:2:in `require': 193: %1 is not a valid Win32 application. - C:/Ruby192/lib/r
uby/gems/1.9.1/gems/mysql2-0.2.6-x86-mingw32/lib/mysql2/1.9/mysql2.so (LoadError
)
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6-x86-mingw32/lib/my
sql2/mysql2.rb:2:in `<top (required)>'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6-x86-mingw32/lib/my
sql2.rb:7:in `require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6-x86-mingw32/lib/my
sql2.rb:7:in `<top (required)>'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/runti
me.rb:64:in `require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/runti
me.rb:64:in `block (2 levels) in require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/runti
me.rb:62:in `each'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/runti
me.rb:62:in `block in require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/runti
me.rb:51:in `each'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/runti
me.rb:51:in `require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler.rb:11
2:in `require'
from C:/Users/Oded/sites/simple_cms/config/application.rb:7:in `<top (re
quired)>'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/comman
ds.rb:28:in `require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/comman
ds.rb:28:in `block in <top (required)>'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/comman
ds.rb:27:in `tap'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/comman
ds.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Can you please help me find the solution?
Happy holidays,
Oded
Looks like you're missing some gems! try running bundle install... then all should work.
EDIT: make sure that your Gemfile contains the line
gem 'mysql'
before running bundle install. Bundler will get you set up for mysql, dependencies and all.
You have to go to this website and follow the directions ...
http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-7-x64-and-using-ruby-with-it/
or in short download the connector mentioned in the article from mysql or a mirror site
Run this command:
gem install mysql --platform=ruby -- --with-mysql-dir=C:/mysql-connector-c-noinstall-6.0.2-win32
Make sure you have the correct path to the mysql connector folder that has no spaces!!
After that is complete make sure you copy the libmysql.dll file from the connector library you unzipped and downloaded and placed that in the Ruby\bin file.
After that delete the connector libary and start it up by typing 'rails server' making sure your gem file has the line gem 'mysql' or gem 'mysql2' I'm not sure which one so try both. It sucks and they really need to fix this for windows.