I am trying to run Rails3 on XP Profesoinal and following the tutorial here http://railstutorial.org and am receiving the following errors all the time, even trying to return static pages. The message is the procedure entry point rb_str2cstr could not be located in the dynamic link library msvcrt-ruby191.dll
Also, the page gives a runtime error "no driver for sqlite3 found" even though i haven't created any models yet. The sqlite3.exe, sqlite3.dll and sqlite3.def are all in the bin folder and I have run Gem install sqlite3-ruby.
I have also tried gem install mongrel --pre and the instructions given http://www.ruby-forum.com/topic/202770#882858, but nothing is working
Here is my minimal fix for the problem:
ruby -v => 1.9.2p0
rails -v => 3.0.0
gem -v => 1.3.7
download sqlitedll-3_7_3.zip from http://sqlite.org/download.html
copy sqlite3.def and sqlite3.dll to ruby/bin
edit Gemfile:
gem 'sqlite3-ruby', '1.3.1', :require => 'sqlite3'
del Gemfile.lock
bundle install
rake db:migrate
Ruby 1.9.2, Rails 3.0
rake db:migrate produces the error message:
The procedure entry point rb_str2cstr could not be located in the dynamic link library msvcrt-ruby191.dll
Resolved by the following:
Delete gemlock.
Change SQLite version to 1.3.1.
Run: bundle install.
rake db:migrate now produces the correct results.
My versions:
ruby -v => 1.9.2p0
rails -v => 3.0.0
gem -v => 1.3.7
Gemfile:
gem 'sqlite3-ruby', :require => 'sqlite3'
Then:
Deleted Gemfile.lock
rake db:migrate
This fixed the error that you mentioned (The same windows pop-up).
Metoo. I was trying to run rake db:migrate on Vista-64. (same book).
Follow-up: I had been trying to solve some other problem by uninstalling and re-installing things and probably messed things up. When I ran into this problem no amount of 'gem uninstall' or 'bundle install's would solve it. Until I removed my Gemfile.lock and did a 'Bundle install'. Then my 'rake db:migrate' ran w/o error. It didn't look like bundle installed anything since all output was 'Using xxx', but I'll take it.
for me this meant "“you need to update your sqlite3-ruby gem version somehow" http://betterlogic.com/roger/?p=3027
I had the same problem with XP Pro and the Rails tutorial. I had SQLite version 1.2.5 installed, which matched what it says in Chapter 2 of the tutorial.
But when I saw roger's comment about using version 1.3.1, I installed that version (using "gem install sqlite3-ruby -v 1.3.1"). But it gave a message about using SQLite version 3.6.23.1 with this gem, along with the relevant website. So I downloaded it and replaced the sqlite3 .exe, .dll and .def files in the C:\Ruby192\bin directory.
Then I looked in the gemfile and saw that the SQLite version was 1.2.5 (as per the tutorial). So I changed it to 1.3.1, deleted gemfile.lock, ran "bundle install" again, and after that "rake db:migrate" worked.
Related
I've been attempting to make a start on learning Ruby/rspec. I read that rspec is now broken for Windows so an early version (2.14.1) should be installed instead. I started on testfirst's learn Ruby but kept getting errors whenever I attempted the "rake" task. I checked my rspec version and apparently I'm running 2.14.8. I thought maybe that was why I was getting some errors. So I typed into git "gem uninstall rspec" but it then said version 2.14.1 was uninstalled, not .8. So I checked to see if there were any versions of rspec installed on my computer and it says that 2.14.8 is still installed... now it won't let me uninstall it, even though I typed in "gem uninstall rspec -v 2.14.8."
I also tried to check the contents of version 2.14.8, but it couldn't find gem 'rspec' in default gem paths.
It's as if I had two versions of rpec on my laptop... how do I get rid of the .8 version?
If gem uninstall rspec -v 2.14.8 did not work for you. Try cleaning up all the rspec version from your computer first by running:
gem cleanup rspec
Then, install the required version again.
Update:
Try:
gem uninstall -Iax rspec
If doesn't work, then try and remove the executables as well:
gem uninstall rspec-core
Where did you hear that RSpec is broken on Windows? AFAIK the current version (3.3.2) works just fine.
If you are going to learn Ruby and RSpec, you should also learn about using Rubygems and Bundler, since many projects rely on them. Install Bundler with:
gem install bundler
Create a new folder and CD into it, and then:
bundle init
This creates a file named "Gemfile" in the folder. This allows Bundler to manage the versions of gems used within your project. Edit the Gemfile and add this line:
gem 'rspec', '~> 3'
This tells Bundler that your project requires RSpec 3, and to install the latest version. Save the Gemfile, and then do:
bundle install
Bundler will install the RSpec gems and create a Gemfile.lock file that details the gem dependencies. To verify that the right version is installed:
rspec --version # => 3.3.2 (or whatever is the latest)
I've been breaking my head over this error for hours now, and still haven't found a fix. When I run sidekiq using sudo -u root -H RAILS_ENV=production script/background_jobs start I'm getting this error in the sidekiq.log:
Gemfile syntax error:
/home/website/git/gitlab/Gemfile:20: syntax error, unexpected ':', expecting $end
gem "mysql2", group: :mysql
I've installed Ruby 2.1.0 and am running CentOS. I've seen other posts with this error, and their problem was that they were running Ruby 1.8, however, I'm running Ruby 2.1.0 and also getting this error.
Any help is greatly appreciated.
EDIT: My gemfile http://pastebin.com/T5z4GZ3a
bundle returns
Your bundle is complete!
Gems in the groups development, test, postgres, puma and aws were not installed.
It was installed into ./vendor/bundle
EDIT2: My background_jobs script http://pastebin.com/kdicTFqk
bundle show bundler returns
2.1.0
/usr/local/rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.2
EDIT3: I think I have found the problem, not sure how to solve it though. I added p RUBY_VERSION as first line of my Gemfile, then I changed every line written like this: group: :mysql to this :group => :mysql (because that is working on older versions).
However, when I run Sidekiq now, this shows up in the sidekiq.log:
"1.8.7"
bundler: command not found: sidekiq
Install missing gem executables with `bundle install`
I am really, really confused now. Here it clearly says my Ruby version is 1.8.7, but that's not right. ruby -v or rvm list rubies only show that Ruby 2.1.0 is installed, and set as default.
Make sure, that when you issue bundle install you have picked up the ruby 2.1.0, just do as follows:
Enter into app's folder, then edit the Gemfile to a few lines, inserting into it p RUBY_VERSION
Issue bundle install, and see the ruby version output, it shell be 2.1.0, and the form of gem "mysql2", group: :mysql should work.
2.1.0
Then add line one-by-one, or group-by-group, issuing the bundle install
So make sure that the Gemfile will be fully restored at the end.
Then you should do a proper setup shell environment in your run script. So if you use the rvm just replace the first line with:
#!/bin/bash -l
Add sourcing to rvm:
source "$HOME/.rvm/scripts/rvm"
Before starting the script, add shell command to set proper version of ruby to 2.1.0
rvm use ruby-2.1.0#global
NOTE: Probably you have to use an other gemset not the global one.
Um quite new to rails and um getting an error when run the command
rails s
it says
Could not find rake-0.9.2.2 in any of the sources
Run bundle install to install missing gems.
when I run bundle install nothing happened
my gem list has rake 0.9.2.2
what can go wrong?
my ruby version is 1.9.3
Thank you in advance
Remove all the versions of Rake ==> gem uninstall rake
Remove your gemfile.lock => rm Gemfile.lock
Remove gem 'rake' on your gemfile
Run bundle install
Install Rake manually : gem install rake --version=10.0.4
When you use command gem list, you will get a list of gem installed on your machine.
For example : rake (10.0.4, 10.0.3, 0.9.2.2)
Just see the console which gem is compatible with your application. It is already mentioned in the error log message.
Use
gem uninstall rake
Keep the suitable one and remove the version who is creating trouble. And then run rails s or bundle exec rails s
Try using rvm and go back to ruby 1.8.7 instead of 1.9.2. This fixed it for me. Don't forget to install rails again (sudo gem install rails while already on 1.8.7) if you have only installed rails for 1.9.3.]
I am having some trouble removing the rake gem version 0.9. I managed to run gem uninstall rake and I believed this to have deleted it. However, going back to gem list it still showed that it still exists.
Running gem env:
GEM PATHS:
/home/sean/.rvm/gems/ruby-1.9.2-p180
/home/sean/.rvm/gems/ruby-1.9.2-p180#global
I went into the #global directory and manually deleted it there, yet still it remains somewhere. I can see it when I run gem list. The 0.9 rake gem is causing problems for my Rails 3.0.7 application.
I ran gem list -d rake:
rake (0.9.0, 0.8.7)
Installed at
(0.9.0): /home/sean/.rvm/gems/ruby-1.9.2-p180#global
(0.8.7): /home/sean/.rvm/gems/ruby-1.9.2-p180
I don't see anything in the gems directory for ruby-1.9.2-p180#global
You should run
rvm use #global && gem uninstall rake -v 0.9.0
rvm use # && gem uninstall rake -v 0.9.0
to correctly remove rake 0.9.0 from rvm
In terminal type in: gem uninstall rake, then select version 0.9.0 when prompted.
Then modify your Gemfile within your Rails application:
gem 'rake', '0.8.7'
Then in terminal run:
bundle install
These steps should fix the problems you are having. Upgrade to rake again when you upgrade to rails 3.1.
If you're using rvm you get rake 0.9 installed "for free" in the global gemset which makes it hard (impossible?) to uninstall properly. gem uninstall rake is successful but doesn't actually remove rake 0.9. I had to do it manually for both REE and 1.9.2.
I edited the rake executable script (find with which rake) and added a:
puts "Gem.bin_path: #{Gem.bin_path('rake', 'rake', version)}
...before the last line. This prints (on my system):
Gem.bin_path: ~/.rvm/gems/ree-1.8.7-2011.03#global/gems/rake-0.9.0/bin/rake
To remove 0.9 cd into ~/.rvm/gems/ree-1.8.7-2011.03 and manually delete all rake-0.9 files (gems, specifications are the ones that count I believe).
I ran into this same problem (needed rake 0.8.7 but got 0.9.0 "for free" with rvm). Initially gem list -d rake gave the following output:
rake (0.9.0, 0.8.7)
Installed at (0.9.0): ~/.rvm/gems/ruby-1.9.2-p136#global
(0.8.7): ~/.rvm/gems/ruby-1.9.2-p136#my_gemset
Switching to the global gemset with rvm use #global gave me this output:
rake (0.9.0)
Installed at: ~/.rvm/gems/ruby-1.9.2-p136#global
So I just did gem uninstall rake. Now, switching back to my gemset with rvm use #my_gemset the correct version of rake (0.8.7) is being used.
If you're using bundler, you should read this excellent article by Yehuda Katz. Following his instructions means you don't have to uninstall rake 0.9.0. Try following command:
bundle exec rake --version
Prepending bundle exec will make sure that only the correct version of the rake is loaded, regardless of others you have installed.
Did you try using the 'gem cleanup' script ?
I'm working on a newly configured computer, and can't seem to get rails to play nicely with my gems. Below are some of the errors I'm running into.
If I run 'script/console' in a rails project, I get the following error:
Missing the Rails gem. Please gem install -v= rails, update your RAILS_GEM_VERSION
setting in config/environment.rb for the Rails version you do have installed, or comment
out RAILS_GEM_VERSION to use the latest version installed.
If I run 'rails -v' I get the following error:
/Library/Ruby/Site/1.8/rubygems.rb:777:in `report_activate_error': RubyGem version
error: activesupport(1.4.4 not = 2.3.4) (Gem::LoadError)
Both activesupport and rails gems are installed and updated, and are listed when I run 'gem list.' Any ideas? Thanks!
Is the location of the gems defined? (either in ~/.bash_profile or ~/.bashrc)
Something like:
export GEM_PATH=/Library/Ruby/Gems/1.8/:${GEM_PATH}
You'll want to see if you have gems on your home directory or off the root. You can do this by running gem environment.