So - a little bit of background on the system I'm running.
I'm on a Mac running Snow Leopard.
I know that Snow Leopard comes pre-installed with Ruby and Rails - but I think I may have messed things up as I found this out after I installed Ruby and Rails again.
When I run ruby -v it displays that I am running ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]. Even though I've gone through the process to try and install 1.9.2!
When I run rails -v it displays that I am running Rails 2.3.5
When I run mysql -v it displays that I am running 5.1.56 MySQL Community Server (GPL)
I can get into the interactive ruby shell and I can get into mysql prompt.
However, when I try to run ruby script/console, it comes up with:
ruby: No such file or directory -- script/console (LoadError)
Furthermore, when I attempt to setup a new folder for a rails project it comes up with the following:
rails railsproject
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:55: uninitialized constant ActiveSupport::Dependencies::Mutex (NameError)
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:53:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:53:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support.rb:56
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:53:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:53:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/bin/../lib/rails_generator.rb:28
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:53:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:53:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/bin/rails:14
from /usr/bin/rails:19:in `load'
from /usr/bin/rails:19
Which directory should I have installed the ruby and rubygems folders into?
Also, do I need to be in a specific directory for the ruby script/console command to work properly?
This is very frustrating - as I tried to uninstall and reinstall ruby and rubgygems multiple times...
Complete newbie with this - any help would be greatly appreciated!
Cheers
Rick
My advice would be to remove all existing packages and use the Ruby Version Manager instead. Just visit the page follow the installation instructions and everything will be fine.
Pragmatic Studio has some instructions for ruby 1.9 and rails 3. These are the directions they give students before participating in one of their courses. Pragmatic Studio also publishes a lot of great ruby/rails books so you could say they're a trusted resource.
Related
I am completing the tutorial on Ruby on Rails 3 Essential Training through Lynda.com on Windows 7, and I am in the section on "Databases and Migrations". I am attempting to sync the database I have created in MySQL with my Rails project, however I have been running into an abort message. The instructor asked my class to go through Command Prompt to open up our rails project and perform a Rake to build a "schema.rb" with this code:
rake db:schema:dump
Yet each time I type the code in I have gotten this error message:
C:\Users\User\Documents\simple_cms>rake db:schema:dump
rake aborted!
cannot load such file -- mysql/mysql_api
C:/Users/User/Documents/simple_cms/config/application.rb:7:in `<top (required)>'
C:/Users/User/Documents/simple_cms/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
Some solutions I have attempted:
I have installed the binary version of mysql. It was built using MySQL Connector/C version 6.0.2. and I added
libmySQL.dll
to
C:\RailsInstaller\Ruby1.9.3\bin
from dev.mysql.com
I have attempted to download the "mysql2" Gem through Command Prompt with the following result:
C:\Users\User\Documents\simple_cms>gem install mysql2
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while..
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
Help?
Or just instalo mysql2 gem. It Works for me at Wim 10.
Are you trying to access a 64 bit MySQL installation from 32 bit Ruby installation. This seems to be problem with a lot of ppl, even I encountered this when I had a new Win7(64 bit) new machine.
try the solution provided on this blog :-
http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-7-x64-and-using-ruby-with-it/
I just recently learned about Vert.x and would like to try it out but I am running into some issues.
I can get a server up written in javascript but cannot get the ruby (jruby) version to run.
May 04, 2012 1:50:57 PM org.vertx.java.core.logging.impl.JULLogDelegate error
SEVERE: backtrace is
/home/curtis/.rvm/rubies/jruby-1.6.6/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
require'
/home/curtis/.rvm/gems/ruby-1.9.3-p125/gems/json-1.6.6/lib/json/ext.rb:13:in
Ext'
/home/curtis/.rvm/gems/ruby-1.9.3-p125/gems/json-1.6.6/lib/json/ext.rb:12:in
JSON'
/home/curtis/.rvm/gems/ruby-1.9.3-p125/gems/json-1.6.6/lib/json/ext.rb:9:in
(root)'
/home/curtis/.rvm/gems/ruby-1.9.3-p125/gems/json-1.6.6/lib/json/ext.rb:36:in
require'
/home/curtis/.rvm/gems/ruby-1.9.3-p125/gems/json-1.6.6/lib/json.rb:58:in
JSON'
/home/curtis/.rvm/gems/ruby-1.9.3-p125/gems/json-1.6.6/lib/json.rb:54:in
(root)'
/home/curtis/.rvm/gems/ruby-1.9.3-p125/gems/json-1.6.6/lib/json.rb:59:in
require'
/home/curtis/src-files/vert.x-1.0.beta11/bin/../lib/ruby/core/event_bus.rb:16:in
(root)'
/home/curtis/src-files/vert.x-1.0.beta11/bin/../lib/ruby/core/event_bus.rb:26:in
(root)'
/home/curtis/src-files/vert.x-1.0.beta11/bin/../lib/ruby/vertx.rb:1:in
`(root)'
This is what happens when I try to simply run the webapp example located in the vert.x-1.0.beta11/examples/ruby/webapp directory. I do have Jruby installed (through rvm)
$ jruby-1.6.6 -v jruby 1.6.6 (ruby-1.8.7-p357) (2012-01-30 5673572)
(OpenJDK Client VM 1.7.0_147-icedtea) [linux-i386-java]
I also have the reccomended JDK/JRE version installed. With the correct paths
.bashrc (bottom)
PATH=$PATH$HOME/.rvm/bin:$HOME/src-files/vert.x-1.0.beta11/bin:/usr/lib/jvm/java-1.7.0-openjdk-i386
I am running into a brick wall sort of, the error messages either don't help much or lead me to believe there is simply a bug in vert.x or jruby.
Advice please?
JRUBY_HOME=$HOME/.rvm/rubies/jruby-1.6.6
Make sure you have json gem installed, it's a prerequisite for the running the ruby version as stated on the vert.x website. Since you're using rvm you can switch to jruby, rvm use [jruby-version] if you've not already and try searching for the json gem as shown below.
gem search json
What is the result when you issue the command above. If you didn't get any response, you can get it installed in your jruby by using this command,
jruby -S gem install json
On the lighter side you should also install yard gem if you want to build the ruby API doc. Hope this helps.
Is the PATH line in your .bashrc just as you wrote here? If so, you need a slash in between $PATH and $HOME. Also, I think rvm likes to have the rvm sourcing line as the last thing in .bashrc, like the following:
# RVM -- don't put anything after this.
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
I am trying to migrate from windows 7 to mac osx .
I have installed the following
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
mysql Ver 14.14 Distrib 5.1.56, for apple-darwin10.3.0 (i386) using
readline 5.1
After a lot of pain I installed my sql gem by :
sudo env ARCHFLAGS="-arch x86_64" gem install --no-rdoc --no-ri mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
But still when I run my project in netbeans I get the following error
[4;36;1mUser Columns (31.5ms)[0m
[0;1mSHOW FIELDS FROM users[0m
[4;35;1mSQL (1.2ms)[0m [0mSHOW
TABLES[0m /!\ FAILSAFE /!\ Wed May
04 09:53:16 +0530 2011 Status: 500
Internal Server Error undefined
method `where' for
Can anyone tell me what am I doing wrong ?
The database migrations are working perfectly.
You stopped copying the stack trace right at the point where it was about to tell you where the error occurs. Look down the stack trace for the first mention of any code from your app (as opposed to the gems or the vendor folder) and it should point you to the problem line.
It's unfortunate that you've having such a time installing the MySQL gem, but this can be complicated if you're loading it on a from-scratch machine that's missing the development headers, something required to compile the extension, and your path does not include /usr/local/mysql/bin which is common.
You can fix that by creating a file /etc/paths.d/mysql with the following:
/usr/local/mysql/bin
Generally you should just have to list mysql in your Gemfile after that, and it should install conventionally with bundle install.
As for the error, it looks like something deeper in your application that's blowing a gasket. When you say "run your project in netbeans," but do you mean run unit tests? It looks like you're calling where on something that doesn't support it.
This looks like an application error. The server is bailing with a 500 when it fails to evaluate the method 'where', somewhere likely in your code.
Modern Mac operating systems (forget which was the first) come with ruby and rails pre-installed - not sure if this is related to your setup.
What happens when you run
rails server
from the console (from within the directory of the app) ?
where is a ActiveRecord 3 AREL class method used for conditions.
First things first, do you have XCode installed? thats a prerequisite to installing any native gems. You can download XCode 3 from the apple site or buy XCode 4 from the app store.
More of the stack trace is required.
Ideally though, once you have installed XCode, you should take a look at https://rvm.io - it's the preferred way for managing rubies on Unixy systems.
Thanks guys.. I finally found the error was with the authlogic gem
I had installed 3.0.2
and the application requires an older version 2.x
/redmine$ ruby script/server -e production
=> Booting WEBrick
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
/home/siya/.rvm/gems/ruby-1.8.7-p330/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement
/home/siya/.rvm/gems/ruby-1.8.7-p330/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:589:in real_connect': Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) (Mysql::Error)
from /home/siya/.rvm/gems/ruby-1.8.7-p330/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:589:inconnect'
This issue occur's when I restart my application. In fact yesterday it was running fine. But today I tried a lot and searched the web, but could not get success.
After googling, I got one command to update the system ie sudo gem update --system
Now new error occurs:
/home/siya/.rvm/gems/ruby-1.8.7-p330/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:55: uninitialized constant ActiveSupport::Dependencies::Mutex (NameError)
from /home/siya/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
Upgrade rails to the latest version (2.3.5 is fairly old).
gem install rails --version 2.3.11
You will also need to update your dependencies in your environment.rb, to set RAILS_GEM_VERSION to 2.3.11
Run rake rails:update
Test! Rails upgrades seem to rarely be seamless. You do have an extensive suite of unit tests, don't you... :)
Some-time, In resolving such type of issues. We again raise any other conflict.
So best part is that,just take the
bakcup of application folder and
public folder. Re-install the whole
rails and ruby.
Because after investing whole day to resolve this issue. I followed this procedure. Please do not waste time.
EDIT: Here's the solution (in case the thread linked to below disappears):
Install ruby 1.8.6 (down from 1.8.7)
gem install rails -v=2.3.8 (same as before)
gem install mysql (version 2.8.1, same as before)
Download libmysql.dll from http://instantrails.rubyforge.org/svn/trunk/InstantRails-win/InstantRails/mysql/bin/libmySQL.dll and deposit it in Ruby186/bin. (Before, I had copied over the libmysql.dll file from Mysql/bin.)
When I attempt rake db:migrate with the database.yml file configured for mysql (not sqlite3) I get the following segfault error:
C:/Ruby187/lib/ruby/1.8/benchmark.rb:306: [BUG] Segmentation fault
ruby 1.8.7 (2010-12-23 patchlevel 330) [i386-mingw32]
I have already looked at this thread: Ruby on Rails Rake Error and don't see any help there.*** It appears that my rails app is configured correctly because when I run rake db:create, rails successfully creates the mysql schema dictated for the development environment in database.yml (or returns a "schema already exists" message).
I'd guess I had mysql configured incorrectly, but the fact that rake db:create works on it makes me think otherwise. I have successfully set up rails and mysql (working together) on three other machines; I don't know what the problem is on this one.
Ruby v. 1.8.7 -
Rails v. 2.3.8 -
Mysql v. 5.1.54
***The user who posted that thread indicated that he solved the problem thanks to a post on aptana. The link to that post, however, points to the home page, so the answer thread appears to have either been moved or removed.
Does this describe the solution as well? http://rubyat.com/blog/2010/06/rails-2-3-8-segmentation-fault/
I found that the last step, using the instantrails dll, solved my problem on Win 7 x64 without my having to change ruby or rails versions.
ruby -v
ruby 1.9.2p290 (2011-07-09) [i386-mingw32]
rails -v
Rails 3.2.0
gem search mysql
mysql (2.8.1 x86-mingw32)