json problems on ubuntu 12.04 - ruby-on-rails

I'm having problems when I try to rake db:migrate. I get the following error:
Could not find json-1.7.5 in any of the sources
Run `bundle install` to install missing gems.
Now, I've already run bundle install and it gave an error when it got to json, but I try it again anyway and get the same error when it gets to json:
Installing json (1.7.5) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native
extension.
/usr/bin/ruby1.9.1 extconf.rb /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot
load such file -- mkmf (LoadError) from
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in require' from
extconf.rb:1:in'
Gem files will remain installed in
/home/chris/.bundler/tmp/2984/gems/json-1.7.5 for inspection. Results
logged to
/home/chris/.bundler/tmp/2984/gems/json-1.7.5/ext/json/ext/generator/gem_make.out
An error occurred while installing json (1.7.5), and Bundler cannot
continue. Make sure that gem install json -v '1.7.5' succeeds before
bundling.
The last part says to make sure gem install json -v '1.7.5' succeeds before bundling, so I run this command and json installs fine:
Building native extensions. This could take a while...
Successfully installed json-1.7.5
1 gem installed
Installing ri documentation for json-1.7.5...
Installing RDoc documentation for json-1.7.5...
But if I try rake db:migrate it starts all over again with the same errors. I've read about issues with json on Mac, but have had no luck with any of those solutions. Any ideas?
I'm running Ubuntu 12.04LTS, ruby 1.9.3, rails 3.2.8, gem 1.8.15 (tried it with 1.9.1 also)

I think that you need to install the -dev package. Try running this command
sudo aptitude install ruby1.9.1-dev
and then bundle install should work.

Related

bundle install fails after installing puma

I'm running bundle install and it failed in the middle with the error:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/Mahmoud/dev-reps/non-docker/normal/vendor/bundle/ruby/2.5.0/gems/puma-4.3.1/ext/puma_http11
/Users/Mahmoud/.rbenv/versions/2.5.5/bin/ruby -r ./siteconf20220308-96584-8zjcoy.rb extconf.rb --with-cppflags=-I/usr/local/opt/openssl/include
checking for BIO_read() in -lcrypto... yes
...
...
An error occurred while installing puma (4.3.1), and Bundler cannot continue.
Make sure that `gem install puma -v '4.3.1' --source 'http://rubygems.org/'` succeeds before bundling.
After some failures to install puma, and after much searching and many trials, I was able to install it through:
gem install puma:4.3.1 -- --with-cflags="-Wno-error=implicit-function-declaration"
and the gem installed successfully, giving:
Building native extensions with: '--with-cflags=-Wno-error=implicit-function-declaration'
This could take a while...
Successfully installed puma-4.3.1
Parsing documentation for puma-4.3.1
Done installing documentation for puma after 0 seconds
1 gem installed
My problem currently is that trying bundle install again still fails with the same error. Tried restarting terminal, but still same. It's as if puma has not been installed at all. What am I doing wrong?
Finally got bundle to work using:
bundle config build.puma --with-cflags="-Wno-error=implicit-function-declaration"
from this answer here

Unable to install JSON ruby gem on Ubuntu

I require the json ruby gem to test some JSON files in Rspec. I use bundler to manage my gems, with my Gemfile looking as such:
source 'https://rubygems.org'
gem 'rake'
gem 'rspec'
gem 'json', '1.8.2'
However when I run bundle install everything passes but the json gem. Of which I get the following error message:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in 'require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in 'require'
from extconf.rb:1:in `<main>'
Gem files will remain installed in /var/lib/gems/1.9.1/gems/json-1.8.2 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/json-1.8.2/ext/json/ext/generator/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've already looked around and seen this suggestion:
sudo apt-get install libgmp3-dev
I've done this but the error is still present. The gem version I'm trying to install is 1.8.2, my ruby version is ruby 1.9.3p484 as this is the last stable release for Ubuntu 14.04 as far as I'm aware
If anyone could help resolve this I'd be very grateful

Could not find gem 'wdm (>= 0.1.0) x86-mingw32' in any of the gem sources listed in your Gemfile

I'm loosing my mind trying to figure out how to solve this issue. I don't know anything about Ruby, I'm just trying to read the docs of react which needs Jekyll to serve them as they're markdowns (didn't understand why they need to complicate things like that). The readme file of the docs says that you have to install these:
Ruby (version >= 1.8.7)
RubyGems (version >= 1.3.7)
Bundler
which I've done. And then you'll have to do these instructions:
cd react/docs
bundle exec rake
bundle exec jekyll serve -w
open http://localhost:4000/react/index.html
But when I execute the second command bundle exec rake, this stupid error is thrown:
Could not find gem 'wdm (>= 0.1.0) x86-mingw32' in any of the gem sources listed in your Gemfile.
Run bundle install to install missing gems.
I run bundle install and it throw an error too:
An error occurred while installing json (2.0.1), and Bundler cannot continue.
Make sure that gem install json -v '2.0.1' succeeds before bundling.
I try to install gem install json -v '2.0.1' and it throws an error:
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
What the hell is going on? Why don't they make something simple? This should be easy not as complicated as rocket science!
Note: I'm using Windows 32bit if that is of some importance.
Any help is very appreciated!
You have to install the DevKit. Learn how here!
Then make sure bundle is installed or install it like this:
gem install bundle

Ruby not installing json -v 1.8.1 as part of bundle, ERROR: Failed to build gem native extension

I've tried installing using as part of the bundle and using sudo, but I get the same error message every time. I'm currently on Ruby 2.0.0 and Rails 4.1.8. I'm not sure what is going on. The exact error message below:
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies...
Using rake 10.4.2 Using i18n 0.6.11
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r
./siteconf20141218-80226-brqexc.rb extconf.rb mkmf.rb can't find
header files for ruby at
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/include/ruby.h
extconf failed, exit code 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/extensions/universal-darwin-14/2.0.0/json-1.8.1/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.
Any advice appreciated.
I've run into similar error on Ubuntu and all I needed to do was:
sudo apt-get install ruby-dev
For Mac, the following gist seems worth to have a look into: Setup mac for ruby dev

Error while creating rails new app project

Can't overcome problem. Everytime i generating new rails project on windows get the massage:
Installing json (1.6.5) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
C:/Ruby193/bin/ruby.exe extconf.rb
C:/Ruby193/bin/ruby.exe: No such file or directory -- extconf.rb (LoadError)
Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.6.5
for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.6.5/ext/json/ext/parser/gem_make.out
An error occured while installing json (1.6.5), and Bundler cannot continue.
Make sure that `gem install json -v '1.6.5'` succeeds before bundling.
i've tried instal json but without lack... I've manage to instal json_pure. But still get this error. 'ruby dk.rb init' not worked too
For building native extensions on Windows, you need to install DevKit. It gives you a Unix-like environment and compilers.

Resources