Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialKramer Keller
11,245 PointsTrouble getting a remote repository I cloned from GitHub to run on my mac.
I setup rails on my comp and successfully have run the server and done a few items after watching some of the Treehouse videos. My whole goal though is to work on an existing project though, so after learning up on Git, Rails, and getting all setup with GitHub I decided to clone an application from GitHub for the first time.
It was easy! I logged in, used the link provided by GitHub ran the clone command on my comp and all of a sudden the files were on my computer. Everything looked great, so I went to check out the site and started in that repo folder by running the following command
bin/rails server
Pretty straightforward, but I got the following error:
Could not find activesupport-5.0.0.1 in any of the sources
Run bundle install
to install missing gems.
So I then ran the bundle install command as suggested, which seemed to do a lot, but then it gave me the following error
An error occurred while installing oj (2.12.14), and Bundler cannot continue.
Make sure that gem install oj -v '2.12.14'
succeeds before bundling.
So as suggested I ran: gem install oj -v '2.12.14'
Then I got a really long message with an error. Any thoughts?
ERROR: Error installing oj:
ERROR: Failed to build gem native extension.
current directory: /usr/local/lib/ruby/gems/2.4.0/gems/oj-2.12.14/ext/oj
/usr/local/opt/ruby/bin/ruby -r ./siteconf20170218-3717-1p2bvl9.rb extconf.rb
Creating Makefile for ruby version 2.4.0 on x86_64-darwin16 <<<<<
creating Makefile
current directory: /usr/local/lib/ruby/gems/2.4.0/gems/oj-2.12.14/ext/oj
make "DESTDIR=" clean
current directory: /usr/local/lib/ruby/gems/2.4.0/gems/oj-2.12.14/ext/oj
make "DESTDIR="
compiling cache8.c
compiling circarray.c
compiling compat.c
compiling dump.c
dump.c:503:8: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
cnt = RSTRING_LEN(rstr);
~ ^~~~~~~~~~~~~~~~~
/usr/local/Cellar/ruby/2.4.0/include/ruby-2.4.0/ruby/ruby.h:976:6: note: expanded from macro 'RSTRING_LEN'
RSTRING_EMBED_LEN(str) : \
^~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/ruby/2.4.0/include/ruby-2.4.0/ruby/ruby.h:972:6: note: expanded from macro 'RSTRING_EMBED_LEN'
(long)((RBASIC(str)->flags >> RSTRING_EMBED_LEN_SHIFT) & \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dump.c:503:8: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
cnt = RSTRING_LEN(rstr);
~ ^~~~~~~~~~~~~~~~~
/usr/local/Cellar/ruby/2.4.0/include/ruby-2.4.0/ruby/ruby.h:977:28: note: expanded from macro 'RSTRING_LEN'
RSTRING(str)->as.heap.len)
~~~~~~~~~~~~~~~~~~~~~~^~~
dump.c:1776:39: warning: 'rb_struct_ptr' is deprecated [-Wdeprecated-declarations]
for (i = (int)RSTRUCT_LEN(obj), vp = RSTRUCT_PTR(obj); 0 < i; i--, vp++) {
^
/usr/local/Cellar/ruby/2.4.0/include/ruby-2.4.0/ruby/ruby.h:1190:33: note: expanded from macro 'RSTRUCT_PTR'
define RSTRUCT_PTR(st) rb_struct_ptr(st)
^
/usr/local/Cellar/ruby/2.4.0/include/ruby-2.4.0/ruby/intern.h:889:25: note: 'rb_struct_ptr' has been explicitly marked deprecated here
DEPRECATED(const VALUE *rb_struct_ptr(VALUE s));
^
dump.c:1776:37: warning: assigning to 'VALUE *' (aka 'unsigned long *') from 'const VALUE *' (aka 'const unsigned long *') discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
for (i = (int)RSTRUCT_LEN(obj), vp = RSTRUCT_PTR(obj); 0 < i; i--, vp++) {
^ ~~~~~~~~~~~~~~~~
4 warnings generated.
compiling err.c
compiling fast.c
fast.c:816:17: warning: 'rb_data_object_alloc' is deprecated: by rb_data_object_wrap [-Wdeprecated-declarations]
doc->self = rb_data_object_alloc(clas, doc, 0, free_doc_cb);
^
/usr/local/Cellar/ruby/2.4.0/include/ruby-2.4.0/ruby/ruby.h:1379:1: note: 'rb_data_object_alloc' has been explicitly marked deprecated here
rb_data_object_alloc(VALUE klass, void *data, RUBY_DATA_FUNC dmark, RUBY_DATA_FUNC dfree)
^
fast.c:1280:24: error: use of undeclared identifier 'rb_cFixnum'
case T_FIXNUM: type = rb_cFixnum; break;
^
1 warning and 1 error generated.
make: *** [fast.o] Error 1
make failed, exit code 2
Gem files will remain installed in /usr/local/lib/ruby/gems/2.4.0/gems/oj-2.12.14 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-16/2.4.0/oj-2.12.14/gem_make.out
2 Answers
David O' Rojo
11,051 PointsUse ruby 2.3.3
.
Ruby 2.4 introduced changes on how it handles integers that break some libraries.
As alternative, you could migrate the project to the most recent version of Rails.
See: https://github.com/rails/rails/issues/27450#issuecomment-269120433
Kramer Keller
11,245 PointsI followed these instructions robots.thoughtbot.com/using-rbenv-to-manage-rubies-and-gems AND for the first time I am at least getting a different error. I used Ruby 2.3.1. Now it is doing the same things as before though, but with the following error - An error occurred while installing pg (0.18.4), and Bundler cannot continue. Make sure that gem install pg -v '0.18.4' succeeds before bundling. All the same issues as before, but not with pg -v '0.18.4'
David O' Rojo
11,051 PointsKramer Keller that usually means that your system does not have the required libraries to compile the pg
gem. Search in Google appending your OS.
Brandon McClelland
4,645 PointsBrandon McClelland
4,645 PointsWhen you start with a cloned Rails project you usually want to run 'bundle install'. It's not uncommon to run into issues with specific gems installing correctly. Unfortunately, you'll need to troubleshoot each gem as you run into the problem. It's generally more helpful to look past the lengthy error message and just go search Google with a query like 'issues installing oj gem' to see what sorts of things might be causing the error. This can shine light on what the error messages are actually meaning. (It looks to me you could be using OSX with a Ruby version that's not playing nice with oj).
When I use other people's code I usually run a virtual machine build that I've provisioned with Vagrant for running rails projects instead of running it directly on my main system. That makes it a lot simpler to make sure you have the correct Ruby, Rails and Gems (and any other stuff) installed for that one project. You could also run everything on your system but using a Ruby version manager like rvm or rbenv. These are both beyond the scope of addressing your actual error but are worth looking into to minimize future errors when trying out code you've pulled from repositories.