I want to run a Rails 4.2.1 application in a docker container on a debian machine.
When I run bundle exec rails s I got this error:
Could not find json-1.7.7 in any of the sources
Run `bundle install` to install missing gems.
When I run bundle install I got this error:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20150604-137-10l84fa. rb extconf.rb
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling generator.c
In file included from generator.c:1:0:
../fbuffer/fbuffer.h: In function 'fbuffer_to_s':
../fbuffer/fbuffer.h:175:47: error: macro "rb_str_new" requires 2 arguments, but only 1 given
VALUE result = rb_str_new(FBUFFER_PAIR(fb));
^
../fbuffer/fbuffer.h:175:20: warning: initialization makes integer from pointer without a cast
VALUE result = rb_str_new(FBUFFER_PAIR(fb));
^
Makefile:237: recipe for target 'generator.o' failed
make: *** [generator.o] Error 1
make failed, exit code 2
Gem files will remain installed in /var/www/test/xyz/vendor/bundle/ruby/2 .2.0/gems/json-1.7.7 for inspection.
Results logged to /var/www/test/xyz/vendor/bundle/ruby/2.2.0/extensions/x 86_64-linux/2.2.0/json-1.7.7/gem_make.out
An error occurred while installing json (1.7.7), and Bundler cannot continue.
Make sure that `gem install json -v '1.7.7'` succeeds before bundling.
Whats going wrong? what can I do now?
docker-rails is a project I just created to make rails with docker (and CI) very easy. I think it can help you and reduce the amount of configuration necessary to get up and running with rails on docker.
It creates a global shared gem volume (to speed up bundler), and has a sample Dockerfile for use.
Given that native error, I'm guessing your Dockerfile is missing a needed package, you may need to update your apt-get statements.
I got the same error. This error is because of the versions of ruby softwares (gems) that we uses doesn't match at some point.
You are using ruby version 2.2.1. Your Gemfile contains the gems of older versions and it depends on json version 1.7.7.
You should install the following ruby version:
ruby-1.9.3-p448
to get rid of the error, OR updating your gems that compatible with ruby version 2.2.1 will do the trick.
Related
This error occurs when I try to install http_parser using gem:
dongl_000#LENNY ~/ava-home (master)
$ gem install http_parser.rb -v '0.6.0'
Building native extensions. This could take a while...
ERROR: Error installing http_parser.rb:
ERROR: Failed to build gem native extension.
c:/Ruby22-x64/bin/ruby.exe -r ./siteconf20160217-15056-1hoiyfc.rb extconf.rb
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
generating ruby_http_parser-x64-mingw32.def
make: *** No rule to make target '/c/Ruby22-x64/include/ruby-2.2.0/ruby.h', need
ed by 'ruby_http_parser.o'. Stop.
make failed, exit code 2
Gem files will remain installed in c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/http_p
arser.rb-0.6.0 for inspection.
Results logged to c:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0
/http_parser.rb-0.6.0/gem_make.out
How can I resolve this issue?
Versions
ruby : 2.2.1
rubyGem : 2.4.5
I was going through this very same issue.
Looked up the Git Repository for the Gem (HTTP_Parser) and found out the reason for my problem:
HTTP_Parser currently doesn't not support a Path with spaces
So I renamed my path and solved it.
To resolve attempt to add the devkit to Ruby like this:
Install Ruby+DevKit from RubyInstaller: Ruby Window Installers
Downloads
Check the "ridk install" checkbox at the end of the installer.
When RIDK runs, pick option 3 to install both MSYS and MINGW dev tools (make is provided with the MINGW stuff).
Open a fresh console (to get fresh environment variables), and rerun your gem or bundle command...and hope for the best.
I'm on windows and trying to install rails. but I get the following error message:
Z:\AlexL\My Documents\rails>gem install rails
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
C:/Ruby193/bin/ruby.exe -r ./siteconf20150211-3312-5ie7vd.rb extconf.rb
creating Makefile
make clean
Makefile:165: *** target pattern contains no `%'. Stop.
make
Makefile:165: *** target pattern contains no `%'. Stop.
make failed, exit code 2
Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.8.
2 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/extensions/x86-mingw32/1.9.1/js
on-1.8.2/gem_make.out
Ruby version is:
ruby 1.9.3p484
I've got this devkit installed DevKit-tdm-32-4.5.2-20111229-1559-sfx
in this folder:
C:\Ruby193\DevKit\
Not sure what else is wrong?
Looks the same as the issue being discussed here.
Apparently, there is a problem with Ruby 1.9.3 and newer RubyGems versions on Windows machines. Their quick-fix solution was to downgrade to an earlier version of RubyGems.
gem update --system 1.8.29
Once you have done that, confirm that gems -v returns 1.8.29 and try your command again.
Otherwise, you can upgrade to Ruby 2.X, which should also resolve this problem.
I have created new twitter-bootstrap project on Webstorm 7 and updated npm then executed the grunt comment I got the below error in Jekyll
Running "jekyll:docs" (jekyll) task Warning:
Please install Jekyll before running this task. Use --force to continue.
Aborted due to warnings.
Then I followed the steps as given by (http://www.madhur.co.in/blog/2011/09/01/runningjekyllwindows.html) URL now I am getting error on
gem install jekyll
step. Please look at the below error log on gem_make.out file
C:/Ruby200/bin/ruby.exe extconf.rb creating Makefile
make "DESTDIR=" generating stemmer-i386-mingw32.def compiling porter.c
make: execvp: gcc: Bad file number make: * [porter.o] Error 127
Please guide me how to come over this issue.
Here is a guide on How to Run Jekyll on Windows.
It covers installing the Ruby DevKit, which is most likely what you're missing.
Alternately, and assuming you're on Windows, you could install Ruby using scoop, it's very simple to use and it will install the DevKit along with Ruby.
I hope this helps.
I'm trying to install the puma gem, but when I run
gem install puma
I get this error message:
Temporarily enhancing PATH to include DevKit
Building native extensions. This could take a while...
ERROR: Error installing puma:
ERROR: Failed to build gem native extension.
C:/Ruby193/bin/ruby.exe extconf.rb
creating Makefile
make
generating puma_http11-i386-mingw32.def
compiling http11_parser.c
ext/http11/http11_parser.rl: In function 'puma_parser_execute':
ext/http11/http11_parser.rl:111:3: warning: comparison between signed and unsigned integer expressions
compiling io_buffer.c
io_buffer.c: In function 'buf_to_str':
io_buffer.c:119:3: warning: pointer targets in passing argument 1 of 'rb_str_new' differ in signedness
c:/Ruby193/include/ruby-1.9.1/ruby/intern.h:653:7: note: expected 'const char *' but argument is of type 'uint8_t *'
compiling mini_ssl.c
In file included from mini_ssl.c:3:0:
c:/Ruby193/include/ruby-1.9.1/ruby/backward/rubyio.h:2:2: warning: #warning use "ruby/io.h" instead of "rubyio.h"
mini_ssl.c:4:25: fatal error: openssl/bio.h: No such file or directory
compilation terminated.
make: *** [mini_ssl.o] Error 1
Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/puma-2.6.0 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/puma-2.6.0/ext/puma_http11/gem_make.out
Adding gem 'puma' to my Gemfile and running bundle install isn't an option, because that just doesn't work with any gem and gives me an error message (which is a separate issue, one that I've circumvented with the other gems I've used by installing them via gem install).
Came across very same issue.
sudo apt-get install libssl-dev
fixed it for me.
I ran bundle update before bundle install and that solved the issue for me.
I'm not sure if that was the only thing that helped, as I manually updated puma before that, using these steps:
Checked which version of openssl Ruby is using by running ruby -v -ropenssl -e "puts OpenSSL::OPENSSL_VERSION"
Downloaded the right openssl version from
http://packages.openknapsack.org/openssl/openssl-1.0.0o-x86-windows.tar.lzma
(got the link from https://github.com/hicknhack-software/rails-disco/wiki/Installing-puma-on-windows and edited it based on the output of #1).
Extracted openssl using http://www.7-zip.org to C:\RailsInstaller\openssl
gem install puma -- --with-opt-dir=C:/RailsInstaller/openssl
Figured out the solution to the puma bundle. Followed directions from https://github.com/hicknhack-software/rails-disco/wiki/Installing-puma-on-windows
First you need to download:
DevKit compatible with your ruby version
OpenSSL Developer Package (contains header files and binaries)
And then:
Install DevKit, e.g. in c:\devkit
Unpack the OpenSSL Package, e.g. in c:\openssl (use 7Zip or PeaZip)
You need to copy the ddls from the bin directory (libeay32.dll and ssleay32.dll) to your ruby/bin directory.
Open a windows console
Initialize the DevKit build environment: c:\devkit\devkitvars.bat (except here, I used this in command prompt instead: ruby dk.rb init)
Now it’s possible to install the puma gem with the OpenSSL packages:
gem install puma -- --with-opt-dir=c:\openssl
I think you hit issue #430
https://github.com/puma/puma/issues/430
Re-installing Ruby might help you as well as it closed this issue on GitHub.
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.