问题
I installed the new Ruby (2.0) and Rails 4.0 and when i do "Rails new test_app" i get the following. Anybody run into this?
[devuser@devbox ~]$ rails new test_app
/usr/local/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in
require': cannot load such >file -- active_support (LoadError) from /usr/local/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in
require' from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0.beta1/lib/rails/generators.rb:4:in ><top (required)>' from /usr/local/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in
require' from /usr/local/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:inrequire' from /usr/local/lib/ruby/gems/2.0.0/gems/railties->4.0.0.beta1/lib/rails/commands/application.rb:28:in
' from /usr/local/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:inrequire' from /usr/local/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in
require' from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0.beta1/lib/rails/cli.rb:15:in<top >(required)>' from /usr/local/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in
require' from /usr/local/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:inrequire' from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0.beta1/bin/rails:7:in
' from /usr/local/bin/rails:23:inload' from /usr/local/bin/rails:23:in
'
回答1:
My problem was permission related. Somehow, the "other" user needs rx permissions. I did the following and it works now:
sudo chmod -R o+rx /usr/local/lib/ruby/gems/2.0.0/gems/
If you getting cannot load such file and its pointing to require statement, check your permissions for /gems folder and folders underneat.
回答2:
Create an gemset and use it in rvmrc.
Then come out of the project using Cd ../
Again enter into project, this time it will show, "RVM has encountered a new or modified .rvmrc file in the current directory"
Type 'Yes'.
and now give bundle install.
It will work.
来源:https://stackoverflow.com/questions/16326439/rails-4-0-install-error-require-cannot-load-such-file-active-support-loade