I'm using Ubuntu 11.10 and the terminal to install and run Rails. Here
is the process I've taken so far to setup Rails:
download and install Ruby 1.9.2 and Rails 3.1.0
-- I did this using sudo apt-get ruby1.9.1 and sudo gem install
rails
I made a new rails app using rails new path/to/app
I went to the new app directory and tried running rails server and got an
error about not having a JS ruby environment
I had to get a JS runtime environment for execjs so I downloaded 'therubyracer'
as well as 'therubyrhino' and added them to my gem file, one at a time like this:
gem
'therubyracer' then ran bundle install
After everything was successful with the install, I ran rails server again
-- with both runtime environments I have had similar errors:
Could not find libv8-3.3.10.4 in any of the sources
Run `bundle install` to install missing gems.
Could not find therubyrhino-1.73.0 in any of the sources
Run `bundle install` to install missing gems.
Bundle knows where these programs live, giving correct pathnames when I
enter bundle show libv8 or bundle show therubyrhino. They are both
in /usr/lib/ruby/gems/1.9.1/gems/_ where all the other gems are
located for the bundle install.
Does anyone know where this exception is coming up in the Rails source
code? Does anyone know how Rails is gathering the gems? Better yet,
anyone had this problem and know how to fix it?
Thanks so much,
Feav
Have you tried starting the server using bundle exec rails server?
This problem has been fixed in a newer version of Rails.
Related
I'm running a Rails 3.0.3 app using RVM (Ruby 1.8.7). When I run bundle install all the gems install and then I get this message Your bundle is complete! It was installed into ./rails. But the app isn't recognizing/see those gems. Not sure what I've done wrong that it's doing this. Let me know if you need any other information.
I bet you accidentally ran bundle install rails at one point, which configured your bundler to install your gems into the ./rails directory.
To reset that, remove the ./.bundle directory (or remove the BUNDLE_PATH line from ./.bundle/config). Then bundle install will put them in the right spot.
I am new to Rails and have been trying to setup up my Mac to handle some development. I am currently in a project folder and trying to install a Gem and get this error:
*bash-3.2$ gem install pg
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /Library/Ruby/Gems/1.8 directory.*
It appears its trying to install this to the 1.8 directory. I would like all gems to be installed only for this project and not for everything.
Here is my folder structure for Rails projects.
Rails Projects:
Project 1:
Project 2:
How do I correct the issue with the gem installation so it only goes into a specific folder. This goes for the ruby version as well.
Thanks for the help.
You need to be using RVM, the Ruby Version Manager, found at http://beginrescueend.com/
I assume you already have installed XCode and Macports (or something like it).
Install rails using "gem install rails"
Use "rails new new-project" to setup your new rails project
Use bundler to add any new gems to your project http://gembundler.com/
Finally, if you want to use MySQL, there is a trick to getting the mysql2 gem configured properly on Mac. That is covered in this stackoverflow post.
Without installing RVM, which you should be doing anyway, you just need to use sudo to install the gems. By default, your user account does not have write permissions to the default gem installation directory.
sudo gem install pg
I'm a beginner programmer and I'm trying to get the rails server to run on OS X Lion. When I type "rails server" into the command line, I get this error:
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:777:in `report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:211:in `activate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:1056:in `gem'
from /usr/bin/rails:18
What do you think a solution to the problem is? Any help you can provide would be greatly appreciated. Thanks!
You need to install the rails gem. You could probably do this by running bundle install inside that project.
Have you installed the Rails Gem?
gem install rails
Then do a gem list to see if Rails is in there.
It's also important that you be in the proper directory. So if you keep all of your apps in /apps/ make sure you are in /apps/my_app before calling the server command.
The Ruby bundled with OS X is too old for Rails 3.
I would recommended using 'rvm' to install the latest stable version of ruby-1.9.2-p260
Since installing ruby requires some compilation, make sure you have a gcc installed. You can install XCode to get an usable gcc.
To install rvm, you need bash, git and curl.
RVM: http://beginrescueend.com/
After that, you can use
gem install rails
Enjoy!
The Lion Server looks at a non-default path for the gem file
For example have a look at the first line of /usr/share/devicemgr/backend/devicemgrd:
#!/usr/bin/env GEM_HOME=/usr/share/devicemgr/webserver/gems GEM_PATH=/usr/share/devicemgr/webserver/gems RAILS_ENV=production /usr/bin/ruby
So to install the missing gems, make sure to install them at the required path:
sudo GEM_HOME=/usr/share/devicemgr/webserver/gems gem install rails
I installed RVM and installed 3 different rubies: 1.8.7, ree, and 1.9.2.
I have a Rails 3.0.9 project that uses 1.8.7.
Now when I try to run the 3.0.9 project, I get this error:
Could not find xml-simple-1.1.0 in any of the sources
However, the following command:
bundle show xml-simple
yields:
/Users/me/.rvm/gems/ruby-1.8.7-p334/gems/xml-simple-1.1.0
Looks right to me. What am I missing here? The application, when running, is clearly not seeing the right path. Yet Bundler, when run at the command line, sees it just fine. I am not certain where these paths are to be set. I am admittedly new to RVM, I installed it because I want to start a new edge project with 1.9.2.
Thank you for any help you can provide.
I needed to learn how to create a gemset, then switch to that gemset. You can always check your gem and ruby environment with rvm using:
rvm info
That's what clued me in. Once I "use"d the appropriate gemset where the gem was installed, it worked great.
Using rvm I installed and am using Ruby 1.9.2p180.
I created a gemset called rails3tutorial and, using it, installed Rails 3.0.7, created "sample_app", then used bundle to install. Very nice.
Then I created a new gemset called rails310b1, installed Rails 3.1.0 Beta 1, created an app, and bundle install'd...but it turned out I was not actually switched to the rails310b1 gemset, and so I ended up installing to ruby-1.9.2p180's default gemset (is that #global?...). I then manually deleted all the gems that had been installed!
Then I switched to rails310b1, and bundle install'd, created an app, fired up the app -- golden.
Now I switch back to the rails3tutorial gemset, and cd to the app created using it, and I get errors when running rails commands like...
$ rails generate integration_test layout_links
/Users/paul/.rvm/gems/ruby-1.9.2-p180#rails3tutorial/bin/rails:19:in `load': no such file to load -- /Users/paul/.rvm/gems/ruby-1.9.2-p180#rails3tutorial/gems/rails-3.1.0.beta1/bin/rails (LoadError)
from /Users/paul/.rvm/gems/ruby-1.9.2-p180#rails3tutorial/bin/rails:19:in `<main>'
It's looking for /Users/paul/.rvm/gems/ruby-1.9.2-p180#rails3tutorial/gems/rails-3.1.0.beta1/bin/rails but why?! $PATH looks fine.
Any suggestions as to what is messed up and how to clean this up, or is it best if I wipe out all my gems/gemsets and start over?...
Thanks!
There is nice screencast with basics of RVM http://screencasts.org/episodes/how-to-use-rvm but it mostly comes to using rubies:
rvm install 1.9.3
cd ~/projects/my-app
touch Gemfile
rvm use --create --rvmrc 1.9.3#rails32
gem install bundler rails
bundle exec rails new .
bundle install
bundle exec rails generate integration_test layout_links
please note you need to prefix most of the commands with bundle exec there is my gem that should save you from this problem rubygems-bundler.
also make sure you use .rvmrc files for every project so when you switch dir in console the proper ruby environment is set, the --rvmrc switch used above will generate one for you.