I am having a issue getting a new rails project up and running. Its been a while since I've created a new project, but have been working on various work related projects with many different rails/ruby versions (all fine). That said, I just tried to create a new project and when I run rails -v or rails new xxxx for that matter I get:
/Users/trevor/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- /Users/trevor/Desktop/config/boot (LoadError)
from /Users/trevor/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from script/rails:5:in `<main>'
Specifics
ruby -v => ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14] * using RVM
which ruby => /Users/trevor/.rvm/rubies/ruby-2.2.2/bin/ruby
gem list => shows all necessary gems (i.e rails, bundler etc)
rvm info =>
ruby-2.2.2:
system:
uname: "Darwin Trevor.local 14.5.0 Darwin Kernel Version 14.5.0: Wed Jul 29 02:26:53 PDT 2015; root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64"
system: "osx/10.10/x86_64"
bash: "/bin/bash => GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin14)"
zsh: "/usr/local/bin/zsh => zsh 5.0.8 (x86_64-apple-darwin14.3.0)"
rvm:
version: "rvm 1.26.11 (latest) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]"
updated: "2 months 7 days 5 hours 33 minutes 19 seconds ago"
path: "/Users/trevor/.rvm"
ruby:
interpreter: "ruby"
version: "2.2.2p95"
date: "2015-04-13"
platform: "x86_64-darwin14"
patchlevel: "2015-04-13 revision 50295"
full_version: "ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]"
homes:
gem: "/Users/trevor/.rvm/gems/ruby-2.2.2"
ruby: "/Users/trevor/.rvm/rubies/ruby-2.2.2"
binaries:
ruby: "/Users/trevor/.rvm/rubies/ruby-2.2.2/bin/ruby"
irb: "/Users/trevor/.rvm/rubies/ruby-2.2.2/bin/irb"
gem: "/Users/trevor/.rvm/rubies/ruby-2.2.2/bin/gem"
rake: "/Users/trevor/.rvm/rubies/ruby-2.2.2/bin/rake"
environment:
PATH: "/Users/trevor/.rvm/gems/ruby-2.2.2/bin:/Users/trevor/.rvm/gems/ruby-2.2.2#global/bin:/Users/trevor/.rvm/rubies/ruby-2.2.2/bin:/Users/trevor/.rvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:bin:/Users/trevor/bin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/git/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/mysql/bin"
GEM_HOME: "/Users/trevor/.rvm/gems/ruby-2.2.2"
GEM_PATH: "/Users/trevor/.rvm/gems/ruby-2.2.2:/Users/trevor/.rvm/gems/ruby-2.2.2#global"
MY_RUBY_HOME: "/Users/trevor/.rvm/rubies/ruby-2.2.2"
IRBRC: "/Users/trevor/.rvm/rubies/ruby-2.2.2/.irbrc"
RUBYOPT: ""
gemset: ""
What I've Tried
rvm gemset empty, empty the current default gemset
gem install rails
Typically I have different gemsets for every project, I switched to one using 2.2.2 with a different gemset, rails new does not work in that config either.
This line in the error seems strange to me: require': cannot load such file -- /Users/trevor/Desktop/config/boot (LoadError) Why would rails be looking on the desktop/config for a boot file?
Preformed rvm implode, reinstalled rvm, same results. However, I did notice that by changing directories I am able to create new projects. For some reason the error has to do with trying to create a project while in Users/trevor/Desktop.
Figured it out, but wanted to post in case someone else is in the same boat. After I realized rails new would work in other directories, obviously something was going on with creating projects on the desktop.
Bottom line, make sure you have no file/directories in the directory where your running a rails command named script. There are probably other file/directory names that could cause conflict as well.
Related
I am new to this Ruby-on-Rails stuff and cannot figure out who to resolve this "RunTimeError"
When I run the following command from /var/www/discourse,
sudo -u www-data RAILS_ENV=production $ruby_path/bundle exec rake db:migrate --trace
...part way through the run, I get the following errors lines...
MiniRacer::RuntimeError: Error: Could not find module `discourse/lib/utilities` imported from `(require)`
JavaScript at missingModule (<anonymous>:247:11)
JavaScript at findModule (<anonymous>:258:7)
JavaScript at requireModule (<anonymous>:24:15)
JavaScript at <anonymous>:26:11
/var/www/discourse/vendor/bundle/ruby/3.1.0/gems/mini_racer-0.6.3/lib/mini_racer.rb:228:in `eval_unsafe'
...
Mini_racer is installed.
discourse/lib/utilities is NOT listed in the source code. Click here to view Github source code
Note: Yes, I know that the official way to run Discourse is with Docker. I am trying to figure out how Ruby-on-Rails pieces fall together and Discourse is what I am fiddling with.
Here is the rvm info output...
admin#rortest:/var/www/discourse$ rvm info
ruby-3.1.3:
system:
uname: "Linux rortest 5.10.0-20-amd64 #1 SMP Debian 5.10.158-2 (2022-12-13) x86_64 GNU/Linux"
name: "Debian"
version: "11"
architecture: "x86_64"
bash: "/usr/bin/bash => GNU bash, version 5.1.4(1)-release (x86_64-pc-linux-gnu)"
zsh: " => not installed"
remote_path: "debian/11/x86_64"
rvm:
version: "1.29.12 (latest)"
updated: "1 hour 11 minutes 18 seconds ago"
path: "/usr/local/rvm"
autolibs: "[4] Allow RVM to use package manager if found, install missing dependencies, install package manager (only OS X)."
ruby:
interpreter: "ruby"
version: "3.1.3p185"
date: "2022-11-24"
platform: "x86_64-linux"
patchlevel: "2022-11-24 revision 1a6b16756e"
full_version: "ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [x86_64-linux]"
homes:
gem: "/usr/local/rvm/gems/ruby-3.1.3"
ruby: "/usr/local/rvm/rubies/ruby-3.1.3"
binaries:
ruby: "/usr/local/rvm/rubies/ruby-3.1.3/bin/ruby"
irb: "/usr/local/rvm/rubies/ruby-3.1.3/bin/irb"
gem: "/usr/local/rvm/rubies/ruby-3.1.3/bin/gem"
rake: "/usr/local/rvm/rubies/ruby-3.1.3/bin/rake"
environment:
PATH: "/usr/local/rvm/gems/ruby-3.1.3/bin:/usr/local/rvm/gems/ruby-3.1.3#global/bin:/usr/local/rvm/rubies/ruby-3.1.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/local/rvm/bin"
GEM_HOME: "/usr/local/rvm/gems/ruby-3.1.3"
GEM_PATH: "/usr/local/rvm/gems/ruby-3.1.3:/usr/local/rvm/gems/ruby-3.1.3#global"
MY_RUBY_HOME: "/usr/local/rvm/rubies/ruby-3.1.3"
IRBRC: "/usr/local/rvm/rubies/ruby-3.1.3/.irbrc"
RUBYOPT: ""
gemset: ""
I really need some help, I am not a Ruby expert and I am trying to get an existing ruby app to run on my Ubuntu server.
I think I have done everything correctly but I keep on getting the following error:
Warning! PATH is not properly set up, $GEM_HOME is not set,
usually this is caused by shell initialization files - check
them for 'PATH=...' entries,
As well as
You are using '.rvmrc', it requires trusting, it is slower and it is
not compatible with other ruby managers,
you can switch to '.ruby-version' using 'rvm rvmrc to ruby-version'
Here is the output from rvm info:
rvm info
Warning! PATH is not properly set up, $GEM_HOME is not set,
usually this is caused by shell initialization files - check
them for 'PATH=...' entries, it might also help to re-add RVM
to your dotfiles: 'rvm get stable --auto-dotfiles',to fix
temporarily in this shell session run: 'rvm use ruby-2.2.1'.
system:
system:
uname: "Linux ip-172-31-22-20 3.13.0-83-generic #127-Ubuntu
SMP Fri Mar 11 00:25:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux"
system: "ubuntu/14.04/x86_64"
bash: "/bin/bash => GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu)"
zsh: " => not installed"
rvm:
version: "rvm 1.27.0 (latest) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]"
updated: "1 hour 16 minutes 14 seconds ago"
path: "/usr/local/rvm"
homes:
gem: "not set"
ruby: "/usr/local/rvm/rubies/ruby-2.2.1"
binaries:
ruby: "/usr/local/rvm/rubies/ruby-2.2.1/bin/ruby"
irb: "/usr/local/rvm/rubies/ruby-2.2.1/bin/irb"
gem: "/usr/local/rvm/rubies/ruby-2.2.1/bin/gem"
rake: "/usr/local/rvm/rubies/ruby-2.2.1/bin/rake"
environment:
PATH: "/usr/local/rvm/gems/ruby-2.2.1/bin:/usr/local/rvm/gems/ruby-2.2.1#global/bin:/usr/local/rvm/rubies/ruby-2.2.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/rvm/bin"
GEM_HOME: ""
GEM_PATH: ""
MY_RUBY_HOME: "/usr/local/rvm/rubies/ruby-2.2.1"
IRBRC: "/usr/local/rvm/rubies/ruby-2.2.1/.irbrc"
RUBYOPT: ""
gemset: ""
THANKS!!!!
UPDATE
Thanks, I was able to set the GEM_HOME and GEM_PATH values by using:
export GEM_HOME=/usr/local/rvm/gems/ruby-2.2.1
export GEM_PATH=/usr/local/rvm/gems/ruby-2.2.1:/usr/local/rvm/gems/ruby-2.2.1#global
echo "source $HOME/.rvm/scripts/rvm" >> ~/.bash_profile
However when I change folders and go back, I get an error (see below) and the variables are no longer set.
You are using '.rvmrc', it requires trusting, it is slower and it is not compatible with other ruby managers,
you can switch to '.ruby-version' using 'rvm rvmrc to ruby-version'
or ignore this warning with 'rvm rvmrc warning ignore /var/www/XXXXX/MicoBackup/.rvmrc',
'.rvmrc' will continue to be the default project file in RVM 1 and RVM 2,
to ignore the warning for all files run 'rvm rvmrc warning ignore all.rvmrcs'.
Gemset 'XXXXXX' does not exist, 'rvm ree-1.8.7-2012.02 do rvm gemset create XXXXXX' first, or append '--create'.
Looks like a duplicate of: https://unix.stackexchange.com/questions/203376/how-to-set-ruby-gem-home-and-gem-path
As the error message indicates, you're missing GEM_HOME in your PATH.
Start by making sure rvm is properly sourced in your .bash_profile:
echo "source $HOME/.rvm/scripts/rvm" >> ~/.bash_profile
If that doesn't work, you can try setting GEM_HOME manually. See the provided link above.
I'm getting this error whenever I run rails (or any rails command)
_rails_command:2: permission denied: bin/rails
ONLY when i'm inside some old rails app directory.
In these directories bundle exec rails c command works but rails or even rails -v don't work.
Background:
I keep my coding workspace in dropbox folder.
Now I recently installed Manjaro and hence all the rails apps which I downloaded back from my previous OS I call them old rails app.
In Short:
Rails works fine everywhere except for old rails apps.
bundle exec rails c works fine though.
Ruby versions which I've tried:
2.0.0 (rvm), 2.1.1(rvm), 2.1.1 (system)
Gem Environment :
RubyGems Environment:
- RUBYGEMS VERSION: 2.2.2
- RUBY VERSION: 2.0.0 (2014-02-24 patchlevel 451) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/tat/.rvm/gems/ruby-2.0.0-p451#latest
- RUBY EXECUTABLE: /home/tat/.rvm/rubies/ruby-2.0.0-p451/bin/ruby
- EXECUTABLE DIRECTORY: /home/tat/.rvm/gems/ruby-2.0.0-p451#latest/bin
- SPEC CACHE DIRECTORY: /home/tat/.gem/specs
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/tat/.rvm/gems/ruby-2.0.0-p451#latest
- /home/tat/.rvm/gems/ruby-2.0.0-p451#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /home/tat/.rvm/gems/ruby-2.0.0-p451#latest/bin
- /home/tat/.rvm/gems/ruby-2.0.0-p451#global/bin
- /home/tat/.rvm/rubies/ruby-2.0.0-p451/bin
- /home/tat/bin
- /usr/local/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/bin
- /usr/bin/core_perl
- /home/tat/.rvm/bin
UPDATE:
Its working fine in bash, the problem seem to be with oh-my-zsh.
Here is my rvm-info (from zsh):
ruby-2.0.0-p451#latest:
system:
uname: "Linux tat-box 3.10.37-1-MANJARO #1 SMP Mon Apr 14 20:56:29 UTC 2014 x86_64 GNU/Linux"
system: "manjaro/0.8.9/x86_64"
bash: "/usr/bin/bash => GNU bash, version 4.3.8(1)-release (x86_64-unknown-linux-gnu)"
zsh: "/usr/bin/zsh => zsh 5.0.5 (x86_64-unknown-linux-gnu)"
rvm:
version: "rvm 1.25.23 (master) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]"
updated: "21 hours 33 minutes 15 seconds ago"
path: "/home/tat/.rvm"
ruby:
interpreter: "ruby"
version: "2.0.0p451"
date: "2014-02-24"
platform: "x86_64-linux"
patchlevel: "2014-02-24 revision 45167"
full_version: "ruby 2.0.0p451 (2014-02-24 revision 45167) [x86_64-linux]"
homes:
gem: "/home/tat/.rvm/gems/ruby-2.0.0-p451#latest"
ruby: "/home/tat/.rvm/rubies/ruby-2.0.0-p451"
binaries:
ruby: "/home/tat/.rvm/rubies/ruby-2.0.0-p451/bin/ruby"
irb: "/home/tat/.rvm/rubies/ruby-2.0.0-p451/bin/irb"
gem: "/home/tat/.rvm/rubies/ruby-2.0.0-p451/bin/gem"
rake: "/home/tat/.rvm/gems/ruby-2.0.0-p451#latest/bin/rake"
environment:
PATH: "/home/tat/.rvm/gems/ruby-2.0.0-p451#latest/bin:/home/tat/.rvm/gems/ruby-2.0.0-p451#global/bin:/home/tat/.rvm/rubies/ruby-2.0.0-p451/bin:/home/tat/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/core_perl:/home/tat/.gem/ruby/2.1.0/bin:/home/tat/.rvm/bin"
GEM_HOME: "/home/tat/.rvm/gems/ruby-2.0.0-p451#latest"
GEM_PATH: "/home/tat/.rvm/gems/ruby-2.0.0-p451#latest:/home/tat/.rvm/gems/ruby-2.0.0-p451#global"
MY_RUBY_HOME: "/home/tat/.rvm/rubies/ruby-2.0.0-p451"
IRBRC: "/home/tat/.rvm/rubies/ruby-2.0.0-p451/.irbrc"
RUBYOPT: ""
gemset: "latest"
In the directory you mentioned is your rails in executable mode. If not you can apply
chmod u+x bin/rails
and make it executable.
Run
bundle exec rake rails:update:bin
It will update bin/rails and bin/rake files.
So what worked for me, anyone coming across this issue is to run
bundle exec rake app:update:bin
You'll be given a prompt asking if you want to overwrite? The options here are:
Y - yes (default one, just press Enter for it)
n - no (leave current file without changes)
a - all (apply all changes)
q - quit
d - diff
h - help
I chose a and it seemed to work ok.
I have this when I try to use a rails 4.0 version.
So when I try to put bundle exec first, like:
bundle exec rake db:migrate
or
bundle exec rails s
work's.
I had the same issue and here's what helped me.
Open ~/.zshrc and add this
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
The solution for me was:
bundle exec rake rails:update:bin
or just use:
For new rails versions:
bundle exec rake app:update:bin
For old rails versions:
bundle exec rake rails:update:bin
I created a new Rails API app. I am trying to create the database table for the app with the command for a postgres db
rake db:create:all
and Im getting this error:
AM#~/Documents/RailsWS/iosprototypevendors >rake db:create:all --trace
rake aborted!
Valid types are [:development, :runtime], not nil
/usr/local/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:52:in `initialize'
/Users/AM/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler- 1.2.0/lib/bundler/resolver.rb:371:in `new'
/Users/AM/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler- 1.2.0/lib/bundler/resolver.rb:371:in `search'
/Users/AM/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-
..............
A bunch of googling I found out that this might have something to do with the wrong version of ruby picked up.
(I recently upgraded my OS to Mountain Lion and had to upgrade my Rails and Ruby versions to the latest. Went through hell for 8 hrs to get rails up and going. Rails works now on my system but this is one discrepancy that just popped up).
In addition
I also noticed that for different rails apps on my system when I check their versions using rails -v the versions of rails sometimes come up as 3.2.1 and other time 3.2.8 and sometimes I get the above error message.
How can this be happenning?
Here is what I get by running this command:
rvm info
ruby-1.9.3-p194:
system:
uname: "Darwin A-Ms-MacBook-Pro.local 12.1.0 Darwin Kernel Version 12.1.0: Tue Aug 14 13:29:55 PDT 2012; root:xnu-2050.9.2~1/RELEASE_X86_64 x86_64"
bash: "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin12)"
zsh: "/bin/zsh => zsh 4.3.11 (i386-apple-darwin12.0)"
rvm:
version: "rvm 1.15.8 (stable) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]"
updated: "1 day 22 hours 15 minutes 59 seconds ago"
ruby:
interpreter: "ruby"
version: "1.9.3p194"
date: "2012-04-20"
platform: "x86_64-darwin12.1.0"
patchlevel: "2012-04-20 revision 35410"
full_version: "ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.1.0]"
homes:
gem: "/Users/AM/.rvm/gems/ruby-1.9.3-p194"
ruby: "/Users/AM/.rvm/rubies/ruby-1.9.3-p194"
binaries:
ruby: "/Users/AM/.rvm/rubies/ruby-1.9.3-p194/bin/ruby"
irb: "/Users/AM/.rvm/rubies/ruby-1.9.3-p194/bin/irb"
gem: "/Users/AM/.rvm/rubies/ruby-1.9.3-p194/bin/gem"
rake: "/Users/AM/.rvm/gems/ruby-1.9.3-p194#global/bin/rake"
environment:
PATH: "/Users/AM/.rvm/gems/ruby-1.9.3-p194/bin:/Users/AM/.rvm/gems/ruby- 1.9.3-p194#global/bin:/Users/AM/.rvm/rubies/ruby-1.9.3- p194/bin:/Users/AM/.rvm/bin:/Users/AM/.rbenv/shims:/Users/AM/.rbenv/bin:/usr/local/bin:/usr/ local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/PostgreSQL/9.1/bin/"
GEM_HOME: "/Users/AM/.rvm/gems/ruby-1.9.3-p194"
GEM_PATH: "/Users/AM/.rvm/gems/ruby-1.9.3-p194:/Users/AM/.rvm/gems/ruby-1.9.3-p194#global"
MY_RUBY_HOME: "/Users/AM/.rvm/rubies/ruby-1.9.3-p194"
IRBRC: "/Users/AM/.rvm/rubies/ruby-1.9.3-p194/.irbrc"
RUBYOPT: ""
gemset: ""
Any help is appreciated
EDIT
Here is what I get when I run the command
echo $PATH on my terminal
/Users/AM/.rbenv/shims:
/Users/AM/.rbenv/bin:
/usr/local/bin:/usr/local/sbin:
/usr/local/mysql/bin:
/Users/AM/.rvm/gems/ruby-1.9.3-p194/bin:
/Users/AM/.rvm/gems/ruby-1.9.3-p194#global/bin:
/Users/AM/.rvm/rubies/ruby-1.9.3-p194/bin:
/Users/AM/.rvm/bin:
/usr/local/bin:
/usr/bin:/usr/bin:
/bin:/usr/sbin:/sbin:
/usr/local/bin:
/Library/PostgreSQL/9.1/bin/
So these are the paths on my system
It's a know path issue. Check if your path contains the valid gem path. Did you install ruby without rvm as well? Take a look: Path's issue with bundler, to change or not to change?
So I didn't get the answers I was looking for. So after my own research I found out this, (in case4 others have this issue)
Mountain Lion ships with Postgresql and a native ruby version 1.8.7. The current ruby
version is 1.9.3. So once you upgrade to mountain lion upgrade your versions of rails
and ruby as well and makke sure you are running the right versions.
rvm is the version management tool on mountain lion and can update aand download these
for you. See this post here
Also if you install the upgrades you will have multiple versions of ruby and rails on
your computer. So it becomes important to set the right version as a default onyour
system. You must do that each time you open a terminal window by the command to check
the versions first: rails -v and ruby -v or rvm list
then you set the default versions like this rvm --default 1.9.3-p194 this will set the
default for that terminal session. If you want a more permanent setup per project then ]
you will have to create a .rvmrc file in the root of every project and specify the
vcersions there for that project to use. again see the post linked to above.
Ill edit this answer as I find more details. In the meanwhile if this answer helped you please consider voting for it . Thanks
Everytime I start my Rails applications I get LoadError with the following output.
On Rails 2.3.8:
no such file to load -- sqlite3/sqlite3_native
<internal:lib/rubygems/custom_require>:29:in `require'
On Rails 3.0.0:
no such file to load -- bundler
<internal:lib/rubygems/custom_require>:29:in `require'
I run the applications in the production mode on a development machine using Nginx + Passenger.
What is the reason of this issue? How can I solve it?
Thanks.
Debian GNU/Linux 5.0.6;
Ruby 1.9.2;
Rubygems 1.3.7;
Ruby on Rails 2.3.8, 3.0.0;
Nginx 0.8.50;
Passenger 2.2.15;
sqlite3-ruby 1.3.1;
bundler 1.0.0.rc.6.
Updated
All of my gems is installed by the unprivileged user in the local directory /home/<usernam>/.gem. If it helps, here's the gem env output:
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.9.2 (2010-08-18 patchlevel 0) [i686-linux]
- INSTALLATION DIRECTORY: /home/<username>/.gem
- RUBY EXECUTABLE: /usr/local/bin/ruby
- EXECUTABLE DIRECTORY: /home/<username>/.gem/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-linux
- GEM PATHS:
- /home/<username>/.gem
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-ri --no-rdoc"
- :gemhome => "/home/<username>/.gem"
- :gempath => ["/home/<username>/.gem"]
- REMOTE SOURCES:
- http://rubygems.org/
Updated
I tackled with the problem. Its source was that I defined a custom gem path. That is I added to the ~/.gemrc file the following lines:
:gemhome: /home/<username>/.gem
:gempaths:
- /home/<username>/.gem
Thus all of my gems was placed in the specified directory but not the default one. For some reason Rubygems coundn't find it there and rose an exception.
When I removed that lines from the file the default paths was set for Rubygems and after I installed all the required gems and loaded my Rails applications all began to work.
Once again, the bug conditions are:
Nginx + Passenger;
The gempath is set to /home/<unprivileged_user>/.gem in ~/.gemrc;
An init.d script is creaded and added to the boot sequence (update-rc.d nginx defaults);
System is rebooted, server is started atomaticlally;
http://localhost/my_rails_app;
LoadError; no such file to load -- <gem_name>; <internal:lib/rubygems/custom_require>:29:in `require'.
Why can't Rubygems find gems in the custom location but can find them in default? That's the question.
I too had this problem when using RVM - I must have specified a gemset or something and not made it project specific. At any rate, read this rvm guide if you want to know the basics of RVM and try to specify a new gemset for your current folder / project, install a new rails gem to that gemset, and then use that gemset. For example, to create a new gemset for rails version 2.3.8:
$ rvm gemset create rails238
$ rvm ruby-1.8.7#rails238
$ gem install rails -v 2.3.8
Then if all went according to plan type rvm gemset use [gemsetName], or do rvm gemset list to see a list of installed gemsets, and to see if rails is working fine try rails -v and you should see rails 2.3.8
Check your system to locate where your rubies and gems are installed ( you can do this by "which ruby" and "which gem"). Usually, they're installed in the same folder (/usr/bin or /usr/local). If they are in different locations, there might be load error. Just a suggestion.