I'm following a tutorial for Rails that specifically asks for version 4.2.0 so I installed Rails with sudo gem install rails -v 4.2.0 and it worked fine. When I try to create a new application with rails _4.2.0 new test_app I get an error message that says /Library/Ruby/Site/2.0.0/rubygems/dependency.rb.315: in 'to_specs': Could not find 'railties' (=4.2.0) - did find: [railties-4.2.1] (Gem::LoadError) and continues on for a little bit more.
I've tried installing that specific version of railties with sudo gem install railties -v 4.2.0 but I still get the same error. Is it checking for/installing the gem in two different places?
EDIT: Running gem list yields the following output, clearly showing railties (4.2.0):
*** LOCAL GEMS ***
actionmailer (4.2.0)
actionpack (4.2.1, 4.2.0)
actionview (4.2.1, 4.2.0)
activejob (4.2.1, 4.2.0)
activemodel (4.2.0)
activerecord (4.2.0)
activesupport (4.2.1, 4.2.0)
arel (6.0.0)
bigdecimal (1.2.6)
builder (3.2.2)
bundler (1.9.9)
erubis (2.7.0)
globalid (0.3.5)
i18n (0.7.0)
io-console (0.4.3)
json (1.8.2, 1.8.1)
loofah (2.0.2)
mail (2.6.3)
mime-types (2.6.1)
mini_portile (0.6.2)
minitest (5.6.1, 5.4.3)
nokogiri (1.6.6.2)
power_assert (0.2.2)
psych (2.0.8)
rack (1.6.1)
rack-test (0.6.3)
rails (4.2.0)
rails-deprecated_sanitizer (1.0.3)
rails-dom-testing (1.0.6)
rails-html-sanitizer (1.0.2)
railties (4.2.0)
rake (10.4.2)
rdoc (4.2.0)
sprockets (3.1.0)
sprockets-rails (2.3.1)
test-unit (3.0.8)
thor (0.19.1)
thread_safe (0.3.5)
tzinfo (1.2.2)
You should not use sudo for installing gems. Use rbenv.
Related
So this time I did my research because of the downvoters...
My question is following.
I am using "Rubymine IDE" for development of Rails application on Win 10 PC, but I can't connect to rails server. I have tried connecting through console, and localhost:3000 and 127.0.0.3000 and 127.0.0.1.3000 but none of them do not work. I have tried creating the project file through console and then running server and it still doesn't work. I have XAMPP installed and that works perfectly fine. I have tried Firefox, Chrome and Edge for browsers. I am using commands such as ruby -s and rails -s and start rails server or ruby server, on the command rails -s I just get list of commands in the console and no results. I really need to get this thing working. I do not know if I need some extra commands to be typed or something else???
I can't add images to my posts yet, bu here is the list of gems I have on my PC
* LOCAL GEMS *
actioncable (5.1.4)
actionmailer (5.1.4)
actionpack (5.1.4)
actionview (5.1.4)
activejob (5.1.4)
activemodel (5.1.4)
activerecord (5.1.4)
activesupport (5.1.4, 4.2.5)
addressable (2.5.2)
arel (8.0.0)
bigdecimal (default: 1.3.0)
bindex (0.5.0)
builder (3.2.3)
bundler (1.16.0)
byebug (9.1.0)
capybara (2.15.4)
childprocess (0.8.0)
coffee-rails (4.2.2)
coffee-script (2.4.1)
coffee-script-source (1.12.2)
concurrent-ruby (1.0.5)
crass (1.0.2)
did_you_mean (1.1.0)
erubi (1.7.0)
erubis (2.7.0)
execjs (2.7.0)
ffi (1.9.18 x64-mingw32)
globalid (0.4.1)
i18n (0.9.1, 0.8.1)
io-console (default: 0.4.6)
jbuilder (2.7.0)
json (default: 2.0.4, 1.8.6)
loofah (2.1.1)
mail (2.7.0)
method_source (0.9.0)
mini_mime (0.1.4)
mini_portile2 (2.3.0, 2.1.0)
minitest (5.10.3, 5.10.1)
multi_json (1.12.2)
net-telnet (0.1.1)
nio4r (2.1.0)
nokogiri (1.8.1 x64-mingw32)
openssl (default: 2.0.5)
power_assert (0.4.1)
psych (default: 2.2.2)
public_suffix (3.0.0)
puma (3.10.0)
rack (2.0.3)
rack-test (0.7.0)
rails (5.1.4)
rails-dom-testing (2.0.3)
rails-html-sanitizer (1.0.3)
railties (5.1.4)
rake (12.2.1, 12.0.0)
rb-fsevent (0.10.2)
rb-inotify (0.9.10)
rdoc (default: 5.0.0)
rubyzip (1.2.1)
sass (3.5.3)
sass-listen (4.0.0)
sass-rails (5.0.6)
selenium-webdriver (3.7.0)
sprockets (3.7.1)
sprockets-rails (3.2.1)
sqlite3 (1.3.13 x64-mingw32)
test-unit (3.2.3)
thor (0.20.0)
thread_safe (0.3.6)
tilt (2.0.8)
turbolinks (5.0.1)
turbolinks-source (5.0.3)
tzinfo (1.2.4, 1.2.3)
tzinfo-data (1.2017.3)
uglifier (3.2.0)
web-console (3.5.1)
websocket-driver (0.6.5)
websocket-extensions (0.1.2)
xmlrpc (0.2.1)
xpath (2.1.0)
Do you have a specific versions of gems installed for Ruby and Rails to work? If not try to install using
gem install ruby #This will install latest version of ruby
and for reference, can you post an image or something which specifies what is happening when you type rails s
Update:
bundle install
This should install all the missing gems and your server should be up and running!
I'm new to Rails and trying to load and configure it for the first time. I'm following the instructions on http://installrails.com/steps/rails_for_linux_and_other for installing on Linux (I'm actually using an Ubuntu Virtual Machine that is installed on a Windows 10 Host).
I keep getting this error:
`rescue in block (2 levels) in require': There was an error while trying to load the gem 'sass-rails'. (Bundler::GemRequireError)
Gem Load Error is: uninitialized constant Sass::Rails::Tilt
There is nothing that seems to be able to tell me what to do from here. I've actually uninstalled, and re-installed Rails once, because I thought my Rails version was creating problems (I did have Rails 5.1.1), but the same thing is happening now (with Rails 4.2.6).
Ruby Version:
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux]
Gem List:
*** LOCAL GEMS ***
actioncable (5.1.1)
actionmailer (5.1.1, 4.2.6)
actionpack (5.1.1, 4.2.6)
actionview (5.1.1, 4.2.6)
activejob (5.1.1, 4.2.6)
activemodel (5.1.1, 4.2.6)
activerecord (5.1.1, 4.2.6)
activesupport (5.1.1, 4.2.6)
addressable (2.5.1)
arel (8.0.0, 6.0.4)
bigdecimal (1.2.8)
bindex (0.5.0)
binding_of_caller (0.7.2)
builder (3.2.3)
bundler (1.14.6)
bundler-unload (1.0.2)
byebug (9.0.6)
capybara (2.14.0)
childprocess (0.7.0)
coffee-rails (4.2.1, 4.1.1)
coffee-script (2.4.1)
coffee-script-source (1.12.2)
concurrent-ruby (1.0.5)
debug_inspector (0.0.3)
did_you_mean (1.0.0)
erubi (1.6.0)
erubis (2.7.0)
execjs (2.7.0)
executable-hooks (1.3.2)
ffi (1.9.18)
gem-wrappers (1.2.7)
globalid (0.4.0)
i18n (0.8.1)
io-console (0.4.5)
jbuilder (2.6.4)
jquery-rails (4.3.1)
json (1.8.6, 1.8.3)
listen (3.1.5)
loofah (2.0.3)
mail (2.6.5)
method_source (0.8.2)
mime-types (3.1)
mime-types-data (3.2016.0521)
mini_portile2 (2.1.0)
minitest (5.10.2, 5.8.5)
multi_json (1.12.1)
mustermann (1.0.0)
net-telnet (0.1.1)
nio4r (2.0.0)
nokogiri (1.7.2)
power_assert (0.2.6)
psych (2.1.0)
public_suffix (2.0.5)
puma (3.8.2)
rack (2.0.3, 1.6.8)
rack-protection (2.0.0)
rack-test (0.6.3)
rails (4.2.6)
rails-deprecated_sanitizer (1.0.3)
rails-dom-testing (2.0.3, 1.0.8)
rails-html-sanitizer (1.0.3)
railties (4.2.6)
rake (12.0.0, 10.4.2)
rb-fsevent (0.9.8)
rb-inotify (0.9.8)
rdoc (4.3.0, 4.2.1)
ruby_dep (1.5.0)
rubygems-bundler (1.4.4)
rubyzip (1.2.1)
rvm (1.11.3.9)
sass (3.4.24)
sass-rails (5.0.6)
sdoc (0.4.2)
selenium-webdriver (3.4.0)
sinatra (2.0.0)
spring (2.0.1)
spring-watcher-listen (2.0.1)
sprockets (3.7.1)
sprockets-rails (3.2.0)
sqlite3 (1.3.13)
test-unit (3.1.5)
thor (0.19.4)
thread_safe (0.3.6)
tilt (2.0.7)
turbolinks (5.0.1)
turbolinks-source (5.0.3)
tzinfo (1.2.3)
uglifier (3.2.0)
web-console (3.5.1, 2.3.0)
websocket (1.2.4)
websocket-driver (0.6.5)
websocket-extensions (0.1.2)
xpath (2.0.0)
Thanks for any help.
try to run following command:
bundle update
If it failed then try to comment below code:
saas-rails
bundle install
I commented out
gem 'sass-rails'
Then did a
bundle update
The server seems to work now. The only thing I'm not completely sure of is if I need that gem for something. (Like I said, I'm new to Rails).
About my environment:
FreeBSD: 9.1
I have changed my shell from csh to bash:
chsh -s /usr/local/bin/bash
Then edited my ~/.bashrc
PATH=$HOME/local/bin:$HOME/local/lib/ruby/gem/bin:$HOME/local/git/bin:$PATH
and source it.
I installed ruby by rbenv
$ rbenv install 2.0.0
After I installed rails
$ gem install rails --version 4.0.0
I can see it in my gem list
$ gem list
*** LOCAL GEMS ***
actionmailer (4.2.1, 4.0.0)
actionpack (4.2.1, 4.0.0)
actionview (4.2.1)
activejob (4.2.1)
activemodel (4.2.1, 4.0.0)
activerecord (4.2.1, 4.0.0)
activerecord-deprecated_finders (1.0.3)
activesupport (4.2.1, 4.0.0)
arel (6.0.0, 4.0.2)
bigdecimal (1.2.0)
builder (3.2.2, 3.1.4)
bundler (1.9.1)
erubis (2.7.0)
globalid (0.3.3)
hike (1.2.3)
i18n (0.7.0)
io-console (0.4.2)
json (1.7.7)
loofah (2.0.1)
mail (2.6.3, 2.5.4)
mime-types (2.4.3, 1.25.1)
mini_portile (0.6.2)
minitest (5.5.1, 4.3.2)
multi_json (1.11.0)
nokogiri (1.6.6.2)
polyglot (0.3.5)
psych (2.0.0)
rack (1.6.0, 1.5.2)
rack-test (0.6.3)
rails (4.0.0)
rails-deprecated_sanitizer (1.0.3)
rails-dom-testing (1.0.6)
rails-html-sanitizer (1.0.2)
railties (4.2.1, 4.0.0)
rake (0.9.6)
rdoc (4.2.0, 4.0.0)
sprockets (2.12.3)
sprockets-rails (2.2.4, 2.0.1)
test-unit (2.0.0.0)
thor (0.19.1)
thread_safe (0.3.5)
tilt (1.4.1)
treetop (1.4.15)
tzinfo (1.2.2, 0.3.43)
But when I type
$ rails -v
it showed me
bash: rails: command not found
And when I type
$ whereis rails
it showed me
rails:
What's wrong about it? How to find the problem?
rake db:migrate
/var/lib/gems/1.9.1/gems/rake-0.8.7/lib/rake/alt_system.rb:32: Use RbConfig instead of obsolete and deprecated Config.
Getting above error on running rake db:migrate.
Below are the list of gems i have installed in my system.
* LOCAL GEMS *
actionmailer (4.1.4, 2.3.14)
actionpack (4.1.4, 2.3.14)
actionview (4.1.4)
activemodel (4.1.4)
activerecord (4.1.4, 2.3.14)
activeresource (4.0.0, 2.3.14)
activesupport (4.1.4, 2.3.14)
arel (5.0.1.20140414130214)
builder (3.2.2)
bundler (1.6.3)
childprocess (0.5.3)
domain_name (0.5.19)
erubis (2.7.0)
ffi (1.9.3)
hike (1.2.3)
http-cookie (1.0.2)
i18n (0.6.11)
json (1.8.1)
mail (2.5.4)
mechanize (2.7.3)
mime-types (2.3, 1.25.1)
mini_portile (0.6.0)
minitest (5.4.0)
multi_json (1.10.1)
mysql (2.9.1)
net-http-digest_auth (1.4)
net-http-persistent (2.9.4)
nokogiri (1.6.2.1)
ntlm-http (0.1.1)
polyglot (0.3.5)
rack (1.5.2, 1.1.6)
rack-test (0.6.2)
rails (2.3.14)
rails-observers (0.1.2)
railties (4.1.4)
rake (0.8.7)
rubyzip (1.1.6)
selenium-webdriver (2.42.0)
sprockets (2.12.1)
sprockets-rails (2.1.3)
thor (0.19.1)
thread_safe (0.3.4)
tilt (1.4.1)
treetop (1.4.15)
tzinfo (1.2.1)
unf (0.1.4)
unf_ext (0.0.6)
watir-webdriver (0.6.10)
webrobots (0.1.1)
websocket (1.1.4, 1.0.7)
Try updating Rake,the log as you posted in question shows rake 0.8.7 version , you might try removing it.
Install latest rake version, might be it resolve your problem
I am trying to use activerecord-import, but I can't seem to get my application to recognize its existence.
I get
undefined method `supports_import?' for #<Class:...>
or
undefined method `import' for #<Class:...>
no matter what I do. I've been googling this for days and trying everything I can think of
It worked when we had rails 2.3.5 and ar-extensions, but since upgrading to rails 3.2 it has been broken.
Everyone says the solution is to use activerecord-import, but I don't seem to know how to do that. I have installed the gem -- I believe the correct version for my version of ActiveRecord -- and I've required it in my code, but there must be some other thing I have to do.
I have this in my Gemfile:
gem 'activerecord-import', "~> 0.3.0"
this in my code:
require 'activerecord-import'
and this is my gem list:
$ gem list
*** LOCAL GEMS ***
actionmailer (3.2.13)
actionpack (3.2.13)
active_utils (2.0.0, 1.0.5)
activemerchant (1.38.1, 1.37.0, 1.34.1)
activemodel (3.2.13)
activerecord (3.2.13)
activerecord-import (0.3.1)
activeresource (3.2.13)
activesupport (3.2.13)
acts_as_tree (1.1.0)
arel (3.0.2)
builder (3.0.4)
bundler (1.2.1)
capistrano (2.15.5)
ckeditor (4.0.6)
climate_control (0.0.3)
cocaine (0.5.1)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.6.3)
composite_primary_keys (5.0.13)
dbf (2.0.6)
erubis (2.7.0)
exception_notification (3.0.1)
execjs (2.0.1, 1.4.0)
fastercsv (1.5.5)
friendly_id (4.0.10.1)
highline (1.6.19)
hike (1.2.3)
i18n (0.6.1)
journey (1.0.4)
jquery-rails (3.0.4)
json (1.8.0)
libv8 (3.16.14.3 x86_64-linux, 3.11.8.17 x86_64-linux)
mail (2.5.4)
mime-types (1.25, 1.23)
mini_magick (3.6.0)
mini_portile (0.5.1)
money (5.1.1)
multi_json (1.8.0, 1.7.9, 1.7.7)
mysql2 (0.3.13)
net-scp (1.1.2)
net-sftp (2.1.2)
net-ssh (2.6.8)
net-ssh-gateway (1.2.0)
newrelic_rpm (3.6.7.152)
nokogiri (1.6.0, 1.5.10)
orm_adapter (0.5.0)
paperclip (3.5.1, 3.5.0)
polyglot (0.3.3)
rack (1.4.5)
rack-cache (1.2)
rack-ssl (1.3.3)
rack-test (0.6.2)
rails (3.2.13)
railties (3.2.13)
rake (10.1.0, 0.9.2.2)
rdoc (3.12.2)
ref (1.0.5)
rmagick (2.13.2)
rubygems-bundler (1.1.0)
rvm (1.11.3.5)
sass (3.2.10, 3.2.9)
sass-rails (3.2.6)
sprockets (2.2.2)
sqlite3 (1.3.8)
subexec (0.2.3)
therubyracer (0.12.0, 0.11.4)
thor (0.18.1)
tilt (1.4.1)
tinymce_fm (0.0.2)
treetop (1.4.15, 1.4.14)
tzinfo (0.3.37)
uglifier (2.2.1, 2.1.2)
will_paginate (3.0.4)
zip (2.0.2)
The answer is that there are some special steps you need to take to use this particular gem.
require "activerecord-import/base"
ActiveRecord::Import.require_adapter('mysql2')
This was found on the github wiki page for activerecord-import