1

I am new to ruby on rails, I am trying to get my first project working with git and heroku. I am following the tutorial by Michael Hartl. I was originally trying to

git push heroku master

but I dont have a GemFile.lock, so I have been trying bundle installs and bundle updates but nothing works because I dont have the json native gem.

bundle update

this is the command that reuturned this error, its not the whole error i left out all the gems i already have

Installing json (1.7.3) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        "C:/Program Files/ruby-1.9.3/bin/ruby.exe" extconf.rb
creating Makefile

make
Makefile:160: warning: overriding commands for target `C:/Program'
Makefile:153: warning: ignoring old commands for target `C:/Program'
C:/Program Files/ruby-1.9.3/bin/ruby -e "puts 'EXPORTS', 'Init_parser'"  > parser-i386
mingw32.def
/bin/sh: C:/Program: No such file or directory
make: *** [parser-i386-mingw32.def] Error 127


Gem files will remain installed in C:/Program Files/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/json-1.7.3 f
or inspection.
Results logged to C:/Program Files/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/json-1.7.3/ext/json/ext/parser/gem_make.out
An error occured while installing json (1.7.3), and Bundler cannot continue.
Make sure that `gem install json -v '1.7.3'` succeeds before bundling.

If anybody knows how to fix my error so that i can move onto the next one or how i can get a working GemFile.lock, it would be appreciated.

Casper
  • 33,403
  • 4
  • 84
  • 79
Tom
  • 91
  • 4
  • 15

3 Answers3

4

Install json_pure instead on your development machine. This is a version of the json gem that does not require C-extensions (but is a bit slower).

On Heroku you should be able to go with the faster json directly.

If you want to build the C-extension on windows then you might want to look here:
The 'json' native gem requires installed build tools

You can create a windows-specific section in the Gemfile like so:

# Common gems
gem 'xyz'
...

# Platform specific gems
platforms :ruby do
  gem 'json'
end

platforms :mswin, :mingw do
  gem 'json_pure'
end 
Community
  • 1
  • 1
Casper
  • 33,403
  • 4
  • 84
  • 79
  • I have already seen that post and tried everything on it. When i get to the last step, ruby dk.rb install, it says that i need GemFile.lock – Tom Jun 05 '12 at 23:34
  • @Tom - Ok. I added some more suggestions for you if you didn't try those yet. – Casper Jun 06 '12 at 00:15
3

Windows isn't properly escaping the space in "C:\Program Files". I haven't used Windows in a while, but a quick search reveals a few fixes.

Community
  • 1
  • 1
Nick Colgan
  • 5,488
  • 25
  • 36
0

I had the same problem and found that in my config.yaml file, there was an installation of Ruby 1.9.2 that had a space in it. I had to uninstall that version of Ruby entirely, and remove it from the PATH in environment variables. Then, I re-installed the DevKit and it worked perfectly.

nfriend21
  • 2,170
  • 1
  • 21
  • 21