I've been away from Ruby on Rails development for some time, going through several system updates. This occurred on Mac OS X Sierra, with its system version of Ruby (2.0.0p648), and Rails 4.0.2.
Creating a new app (rails new appname
) works fine when the appname
directory doesn't exist---the command creates the app and populates it as it should. However, despite what all the guidebooks and tutorials say, it fails when such a directory exists (even when it's empty). You also can't create an empty directory, cd into it, and run rails new .
The output of the failed command looks like this:
exist
/Library/Ruby/Gems/2.0.0/gems/railties-4.0.2/lib/rails/generators/app_base.rb:97:increate_root': uninitialized constant Rails::Generators::AppBase::FileUtils (NameError) from (eval):1:in
create_root' from /Library/Ruby/Gems/2.0.0/gems/thor-0.20.0/lib/thor/command.rb:27:inrun' from /Library/Ruby/Gems/2.0.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in
invoke_command' from /Library/Ruby/Gems/2.0.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:inblock in invoke_all' from /Library/Ruby/Gems/2.0.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in
each' from /Library/Ruby/Gems/2.0.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:inmap' from /Library/Ruby/Gems/2.0.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in
invoke_all' from /Library/Ruby/Gems/2.0.0/gems/thor-0.20.0/lib/thor/group.rb:232:indispatch' from /Library/Ruby/Gems/2.0.0/gems/thor-0.20.0/lib/thor/base.rb:466:in
start' from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.2/lib/rails/commands/application.rb:43:in<top (required)>' from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:68:in
require' from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:68:inrequire' from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.2/lib/rails/cli.rb:15:in
<top (required)>' from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:68:inrequire' from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:68:in
require' from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.2/bin/rails:9:in<top (required)>' from /usr/bin/rails:22:in
load' from /usr/bin/rails:22:in `'
How do I get rails to be able to create the app in an existing directory?