I've got an existing rails app using webpacker and I just attempted to migrate from rvm to rbenv. Everything appeared to be working in my automated tests, but when I try to fire up bin/webpack-dev-server, it seems to want to use the System ruby rather than the one specified by my Gemfile (and my .ruby-version). It tells me:
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in 'require': cannot load such file -- bundler/setup (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in 'require'
from ./webpack-dev-server:12:in '<main>'`
As near as I can tell, this is happening because of the following line at the top of the webpack-dev-server script:
#!/usr/bin/env ruby
but I do not know how to make it work properly with rbenv. When I run rails webpacker:check_binstubs, it does not show me any errors, but clearly there is a problem. Did I miss a step in removing rvm? Please help.
I am trying to create new project using rails but it display error. I am working on mac and its display error.
$rails new EMS
/Users/.rvm/gems/ruby-2.2.0/bin/rails:23:in `load': cannot load such file -- /Users/.rvm/gems/ruby-2.2.0/gems/rails-4.2.0/bin/rails (LoadError)
from /Users/.rvm/gems/ruby-2.2.0/bin/rails:23:in `<main>'
from /Users/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in `eval'
from /Users/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in `<main>'
One day i also faced same issue when i was trying to create new rails application. So followed these below steps and it was soled,
Uninstall the rails
Uninstall the ruby
Again install the latest version of ruby using rvm
than install the rails using command gem install rails
After following these step, now i am able to create new app. May be this also help you to solve this error.
If you are using windows OS as your development environment then please see this link : "certificate verify failed" error when installing Ruby gems on Windows
And I would recommend you to use : http://railsinstaller.org/en
By the way , Brother , Rails would behave perfect with Linux based platform .
And for mac os please take a look at : https://rvm.io/rvm/install
This will help you to have multiple ruby version and to switch between them ... to use full power of ruby and gems.
I'm trying to use feedzirra with Rails 3 On Windows 7, but have been having real issues getting Curl and Curb installed. I found this question Install Ruby Curb gem in windows XP which enabled me to get the gem installed successfully, but now when I try and start my rails server I get the following error:
C:/Ruby193/lib/ruby/gems/1.9.1/gems/curb-0.8.1/lib/curb.rb:1:in `require': 193: %1 is not a valid Win32 application. - C:/Ruby193/lib/ruby/gems/1.9.1/gems/curb-0.8.1/lib/curb_core.so (LoadError)
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/curb-0.8.1/lib/curb.rb:1:in `<top (required)>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/feedzirra-0.0.24/lib/feedzirra.rb:4:in `require'
...
the file curb_core.so does exist, but windows doesn't know how to open it and says it's not a valid Win32 application. Any ideas how I can get this to work? Or does anyone know of any other good RSS readers for rails, that don't use Curb?
Thanks
Ben,
Not sure if you're still looking to use Feedzirra, but to get it to work on my machine (Windows 7), I had to copy both libcurl.dll and libidn-11.dll into the Ruby bin directory. After that it worked with no problem.
Try copying libcurl.dll form your curl installation to ruby /bin directory. Solved the problem for me.
This is getting quite frustrating. I've eventually resorted to completely removing RVM, and reinstalling from scratch, as a normal user, so restricted to my /home.
After reinstall, I've run gem update --system and gem install rails.
Then I run rails --help, and get the following error:
rails --help
/home/anthony/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- /home/anthony/config/boot (LoadError)
from /home/anthony/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from script/rails:5:in `<main>'
Apparently rails thinks it should be loading a file /home/anthony/config/boot. It looks like the load path is screwed.
I've searched this out, and most people getting this error solve it with gem update --system (which I've one as above), or can at lest run rails -- or rails new . None of these work.
Final System info:
https://gist.github.com/1424644
Please help!
This may be totally a red herring, but it looks like your rails is in a different gemset - "campingground" - than either gem or ruby, which are in your default gemset. I'm not sure if this will cause the issue you're seeing or not - I believe it's OK if you're using the campingground gemset rvm use ruby-1.9.3-p0#campingground, but not if you're using the default gemset rvm use ruby-1.9.3-p0 because I believe that gemsets all inherit the default gemset, but not vice versa. I've had some issues with the bin launchers of ruby helpers (like the rails command) barfing all sorts of confusing load errors, which are often this very issue. Again, not sure if helpful, but I'd share that shot in the dark.
After upgrading my Rails install to Rails 3 on OS X, I’ve had problems running my Rails 2.x development sites with Mongrel. WEBrick seems to work, but I really would like to have the nice output of Mongrel for debugging.
After running $ script/server I get this:
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in `load': no such file to load -- mongrel_rails (MissingSourceFile)
from /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in `load'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in `new_constants_in'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in `load'
from /Library/Ruby/Gems/1.8/gems/rails-2.0.2/lib/commands/servers/mongrel.rb:64
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:49:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:49:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in `new_constants_in'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require'
from /Library/Ruby/Gems/1.8/gems/rails-2.0.2/lib/commands/server.rb:39
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:49:in `gem_original_require'
So far, here’s what I’ve tried:
$ sudo gem update system
$ sudo gem update
$ sudo gem uninstall mongrel
$ sudo gem install mongrel --include-dependencies
$ which mongrel_rails
→ /usr/bin/mongrel_rails
$ mongrel_rails start
→ Success, but no stdout
$ which mongrel_rails
→ /usr/bin/mongrel_rails
$ rails _2.0.2_ test
→ Fresh application has same problem.
OS: OS X.6.x
Rails: 3.0.5 (problems are with Rails 2.x apps)
gem -v: 1.6.1
Mongrel: mongrel (1.1.5)
I’ve read EVERY Google result on "-- mongrel_rails (MissingSourceFile)"; there aren’t many.
Can anyone here tell me how to proceed in debugging this? Thanks!
UPDATE:
I’ve now tried installing older versions of the gem and specifying those in my Rails 2.x site’s config/environment.rb file. I’ve tried 1.1.5, 1.1.4, and 1.2.0pre.
None of these makes the slightest bit of difference.
Since the executable in in usr/bin I’m wondering if it’s a file ownership issue that got screwed up on my Rails 3 install and if one of the files isn’t getting my paths when it runs?
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb
is owned by admin / root, so that should be OK, right?
Could it be a problem with active_support!?
Here’s the code from dependencies.rb that’s throwing the error:
484 class Object
485
486 alias_method :load_without_new_constant_marking, :load
487
488 def load(file, *extras) #:nodoc:
489 Dependencies.new_constants_in(Object) { super(file, *extras) }
490 rescue Exception => exception # errors from loading file
491 exception.blame_file! file
492 raise
493 end
...
This is getting a file not found error, so it’s not looking where I know the file to be…
Running mongrel_rails on command line works…
Which mongrel_rails shows it in usr/bin,
So what’s the problem?
I have got the same problem and found the reason.
This happens because new version of RubyGems(1.6.2) does not add 'any_gem/bin' to ruby load path ($LOAD_PATH) when you require "any_gem".
For example in RubyGems version = 1.4.1 this works fine. After I require 'mongrel' I can see in load path next:
...rvm/gems/ruby-1.8.7-p330/gems/mongrel-1.1.5/bin
...rvm/gems/ruby-1.8.7-p330/gems/mongrel-1.1.5/lib
...rvm/gems/ruby-1.8.7-p330/gems/mongrel-1.1.5/ext
With new version (1.6.2) I can see only:
...rvm/gems/ruby-1.8.7-p330/gems/mongrel-1.1.5/lib
...rvm/gems/ruby-1.8.7-p330/gems/mongrel-1.1.5/ext
That's why ruby cannot find 'mongrel_rails'.
You need to add "/usr/bin" to your load path. Perhaps something broke in it?
The best way to fix it is to add:
$:.push("/usr/bin/")
Somewhere before it breaks. Probably by itself in a config/preinitializer.rb file if you don't have one.
OK, here's ONE answer. I got mongrel to boot...but it's hacky, and doesn't solve the real problem...but at least for NOW I can get back to work on this project.
Here's what I did...YES..it's HACKY.
I edited the file throwing the error...dependencies.rb
I added a hook to call out the specific path to mongrel rails if that was the file it was trying to load.
def load(file, *extras) #:nodoc:
if file == "mongrel_rails"
file ="/usr/bin/mongrel_rails"
end
Dependencies.new_constants_in(Object) { super(file, *extras) }
rescue Exception => exception # errors from loading file
exception.blame_file! file
raise
end
Again, I would really like to fix the underlying problem here...but this at least let me boot up.
I would definitely look in to using RVM for running multiple gem versions simultaneously locally. I ran into a lot of quirks when I was attempting to run multiple versions like you are with sudo gem installs of everything.
Now it's as simple as rvm ree#my_app_1, and installing completely separate gems there, then switching to a different app and using rvm ree#my_app_2
ree is an alias for my install of ruby enterprise version, you could just as easily do it with ruby 1.9, 1.8.x, etc.
In each of my application's root directories I have a .rvmrc file that reads simply:
rvm ree#my_app --create
So that every time I switch to that directory, the gemset is automatically swapped for me.
I wasn't aware there was Rails 3 mongrel support.
Most people use Thin (you can enable it by specifying gem 'thin' in your Gemfile then launching rails server thin / Webrick these days.
If this is for hosting then there's nginx and Passenger that'll help with that.
I ran into the same problem -- got my app going by running "mongrel_rails" from the project directory (instead of "script/server").
This is the thread where you are able to find the best answer to the mongrel_rails (MissingSourceFile) error. I just want to conclude here how I solved the problem, using stuff in this thread.
The simplest solution I could figure out how to do was to downgrade RubyGems by typing
(sudo) gem update --system 1.4.1
This lets me run the old 2.1.0 app (thanks Max Shytikov), but there's probably a lot of bugfixes that I'm missing by running the old version of rubygems. The error is probably a blunder by the mongrel gem developers (I guess).
Anyway if you just want to run your app using mongrel do it like this. If you insist on having the newest version of rubygems, you can just run your app with
script/server webrick
But I've found that webrick is a fair bit slower, so I prefer mongrel. If anyone has got a better solution for this problem, please let me know.
I ran into the same error. The fix is to add the mongrel "bin" directory to the $LOAD_PATH. Other posts describe how to do it by modifying source code, but since I share source code with other developers, I prefer to set the RUBYLIB environment variable instead.
$ export RUBYLIB=/Users/edwingo/.rvm/gems/ruby-1.8.7-p302#junction/gems/mongrel-1.1.5/bin
This causes the MRI ruby runtime to prepend that to the $LOAD_PATH.
Detailed explanation: MRI is unable to find 'mongrel_rails' because it is not on the $LOAD_PATH. I am using RVM and when I installed mongrel into a gemset, for some reason the $LOAD_PATH does not include the corresponding "bin" directory where 'mongrel_rails' lives. When not using RVM and after installing mongrel into the system gems, the "bin" directory does appear on the $LOAD_PATH so it all works.