Ruby and Rail Application Error when Running Bundle install - ruby-on-rails

I am following a heroku tutorial where I created my rails app. I was asked to use Heroku to get my app live online. But I have troubled to run the command Bundle install. It keeps giving me an error.
I tried to re-install Rail Bundler on my Terminal, but it shows me this error at the terminal:
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
extconf.rb
creating Makefile
make "DESTDIR="
compiling generator.c
In file included from generator.c:1:
In file included from ./../fbuffer/fbuffer.h:5:
In file included from
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby.h:33:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/ruby.h:24:10:
fatal error: 'ruby/config.h' file not found
#include "ruby/config.h"
^
1 error generated.
make: *** [generator.o] Error 1
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/json-1.8.1 for
inspection.
Results logged to
/Library/Ruby/Gems/2.0.0/gems/json-1.8.1/ext/json/ext/generator/gem_make.out
An error occurred while installing json (1.8.1), and Bundler cannot
continue.
Make sure that `gem install json -v '1.8.1'` succeeds before bundling.

Related

gem install eventmachine -v '1.2.7' error

I am new to Ruby on Rails and I'm trying to create a website using the same. I have added a few gems to my gem file and trying to bundle them, but encounter this error.
An error occurred while installing eventmachine (1.2.7), and Bundler cannot continue.
Make sure that gem install eventmachine -v '1.2.7' --source 'https://rubygems.org/' succeeds before bundling.
I have tried doing gem install eventmachine -v '1.2.7' but get this error:
ERROR: Failed to build gem native extension.
current directory: /.rvm/gems/ruby-3.0.0/gems/eventmachine-1.2.7/ext
make "DESTDIR=" clean
current directory: /.rvm/gems/ruby-3.0.0/gems/eventmachine-1.2.7/ext
make "DESTDIR=" compiling binder.cpp In file included from
binder.cpp:20: ./project.h:119:10: fatal error: 'openssl/ssl.h' file not found
#include <openssl/ssl.h>
^~~~~~~~~~~~~~~ 1 error generated. make: *** [binder.o] Error 1
Can someone please help?
#include <openssl/ssl.h>
You seem to be missing the c++ development source necessary for ruby to install openssl.
Install libssl-dev and try the gem installation again. You may be missing other development libraries as well.

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. - Yosemite

I am using Rails 4. Bundle was working up until yesterday, when I had to reinstall Bundler because of a different error. Now, when I run "bundle install", a few gems are successfully installed and then I receive this error message:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/local/bin/ruby -r ./siteconf20150509-3462-k6ug3q.rb extconf.rb
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling generator.c
make: gcc-4.2: No such file or directory
make: *** [generator.o] Error 1
make failed, exit code 2
Gem files will remain installed in /usr/local/lib/ruby/gems/2.0.0/gems/json- 1.8.2 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.0.0/extensions/x86_64-darwin- 10/2.0.0-static/json-1.8.2/gem_make.out
An error occurred while installing json (1.8.2), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.2'` succeeds before bundling.
I then try to 'gem install json -v '1.8.2' and get this error message:
Building native extensions. This could take a while...
/usr/local/lib/ruby/site_ruby/2.0.0/rubygems/ext/builder.rb:73: warning:
Insecure world writable dir /usr/local/lib/ruby/gems/2.0.0 in PATH, mode 040777
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby -r ./siteconf20150509-3898-12pmbxe.rb extconf.rb
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling generator.c
make: gcc-4.2: No such file or directory
make: *** [generator.o] Error 1
make failed, exit code 2
Gem files will remain installed in /usr/local/lib/ruby/gems/2.0.0/gems/json-1.8.2 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.0.0/extensions/x86_64-darwin- 10/2.0.0-static/json-1.8.2/gem_make.out
I have no idea how to fix this. I have tried several solutions including:
-"rvm implode"
-"sudo gem update --system"
-"sudo gem update --system --no-user-install"
-"sudo chmod 755 /usr/local/lib/ruby/gems/2.0.0/gems"
-"xcode-select --install"
-running Disk Repair
I read a few things about making changes to the path and bash profile, but I am unclear on how to do that.
Thank you in advance! Already spent 2 hours trying to solve this.
Answered in this stack question : Insecure world writable dir /Users/username in PATH, mode 040777 when running Ruby commands
Your home folder should only be writable by you, not by anyone else. The reason gem is complaining about this is that you have folders in your PATH that are inside your (insecure) home folder, and that means that anyone who wants to could hack you by renaming/moving your .rvm folder and replacing it with an impostor.
To fix your home folder, run chmod go-w /Users/kristoffer. If there are any other insecure folders on the way to anything in your PATH, you should fix them similarly.
BTW, the reason that Disk Utility didn't repair this is that it only repairs files installed as part of the OS (see Apple's KB article on the subject). There is an option to repair home folder permissions if you boot from the install DVD and run Password Reset from the Utilities menu, but I'm not sure if it resets the permissions themselves or just ownership.
Update
Installing a new version of Ruby seemed to work. Previously I was using 2.0.0, and now I upgraded to 2.2.2. This seems to have made the issue go away.

Ruby on Rails new app creation failing on Windows

I'm new to Ruby on Rails, and am trying to make an app.
I ran rails new myApp, and it ran into a problem when installing byebug.
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
C:/Ruby21/bin/ruby.exe extconf.rb
creating Makefile
make "DESTDIR=" clean
0 [main] rm 5012 open_stackdumpfile: Dumping stack trace to rm.exe.stackdump
make: [clean-static] Error 5 (ignored)
0 [main] rm 4148 open_stackdumpfile: Dumping stack trace to rm.exe.stackdump
make: [clean] Error 5 (ignored)
make "DESTDIR="
generating byebug-i386-mingw32.def
compiling breakpoint.c
cc1.exe: warnings being treated as errors
In file included from c:/Ruby21/include/ruby-2.1.0/ruby/defines.h:217:0,
from c:/Ruby21/include/ruby-2.1.0/ruby/ruby.h:29,
from c:/Ruby21/include/ruby-2.1.0/ruby.h:33,
from ./byebug.h:4,
from breakpoint.c:1:
c:/Ruby21/include/ruby-2.1.0/ruby/win32.h:320:44: error: 'struct timespec' declared inside parameter list
c:/Ruby21/include/ruby-2.1.0/ruby/win32.h:320:44: error: its scope is only thisdefinition or declaration, which is probably not what you want
c:/Ruby21/include/ruby-2.1.0/ruby/win32.h:321:43: error: 'struct timespec' declared inside parameter list
make: *** [breakpoint.o] Error 1
make failed, exit code 2
Gem files will remain installed in C:/Ruby21/lib/ruby/gems/2.1.0/gems/byebug-4.0.5 for inspection.
Results logged to C:/Ruby21/lib/ruby/gems/2.1.0/extensions/x86-mingw32/2.1.0/byebug-4.0.5/gem_make.out
An error occurred while installing byebug (4.0.5), and Bundler cannot continue.
Make sure that `gem install byebug -v '4.0.5'` succeeds before bundling.
So it looks like the compiler is treating warnings as errors, and byebug has a warning? And I need to configure the compiler to not treat warnings as errors?
You should try to uninstall/reinstall DevKit for Windows as MarsAtomic adviced.
For Mac what worked for me was running
xcode-select --install
and specifying github: 'deivid-rodriguez/byebug' for byebug in Gemfile (not sure that it's necessary though).

Rails – Bundle install problems with json

I'm running OS X Mavericks, with Rails 3.2.12. When I try to do rails new project, it gets stuck at bundle install.
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-1.9.3-p392/bin/ruby extconf.rb
creating Makefile
make
compiling generator.c
make: gcc-4.2: No such file or directory
make: *** [generator.o] Error 1
Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p392/gems/json-1.8.1 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p392/gems/json-1.8.1/ext/json/ext/generator/gem_make.out
An error occurred while installing json (1.8.1), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.1'` succeeds before bundling.
I get the same error when I do 'gem install json....' as it suggests. I've installed the latest version of Xcode, with the command line tools. When I do:
which gcc
I get:
/usr/bin/gcc
I'm new to all this stuff really, so please try to keep things simple.
So, prior to XCode 5, there was a gcc-4.2 binary, which got removed in the upgrade.
I found this tutorial helpful in getting gcc-4.2 back and running with ruby. It assumes that you're using homebrew to manage packages on your Mac.

/usr/bin/gcc-4.2: No such file or directory. error. symlink fix doesn't work

I'm trying to upgrade my rails 3.2.3 app. I've updated the gemfile to gem 'rails', '3.2.11' and ran bundle update rails but got the following error:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/Arel/.rvm/rubies/ruby-1.9.3-head/bin/ruby extconf.rb
creating Makefile
make
compiling generator.c
make: /usr/bin/gcc-4.2: No such file or directory
make: *** [generator.o] Error 1
Gem files will remain installed in /Users/Arel/.rvm/gems/ruby-1.9.3-head/gems/json-1.7.6 for inspection.
Results logged to /Users/Arel/.rvm/gems/ruby-1.9.3-head/gems/json-1.7.6/ext/json/ext/generator/gem_make.out
An error occured while installing json (1.7.6), and Bundler cannot continue.
Make sure that `gem install json -v '1.7.6'` succeeds before bundling.
So I tried the solution that I found everywhere, to create a symlink using the command:
sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
but that just returns the error:
ln: /usr/bin/gcc-4.2: File exists
I don't know a lot about using the terminal to navigate around OSX, so I'm kind of struggling here. Any ideas?
/usr/bin/gcc-4.2 could already be a symlink, but a broken one that points to a nonexistent file.

Resources