I got way too many problems setting up a ruby development enviornment on my windows.
I already installed Ruby 1.9.3, DevKit for Ruby 1.9.3, RubyGems and Ruby on Rails. (Also the client for Heroku and Git, but I don't think these tools do matter for a solution.)
I now have several problems:
-> bundle update doesn't do what it should do, it always cancels because JSON isn't installed
-> same goes for bundle install, it cancels because JSON is missing
-> can't use rails server because of the missing JSON
-> if I try to use gem install json I'm getting the following error:
D:\Bibliotheken\Dokumente\RailsProjects\first_app>gem install json
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
"D:/Program Files (x86)/Ruby 1.9.3/bin/ruby.exe" extconf.rb
D:/Program Files (x86)/Ruby 1.9.3/bin/ruby.exe: invalid switch in RUBYOPT: -F (RuntimeError)
Gems will remain installed in D:/Program Files (x86)/Ruby 1.9.3/lib/ruby/gems/1.9.1/gems/json-1.8.1 for inspection.
Results logged to D:/Program Files (x86)/Ruby 1.9.3/lib/ruby/gems/1.9.1/gems/json-1.8.1/ext/json/ext/generator/gem_make.out
-> after this try I can't call rails -v anymore, it's putting an error to the console aswell
<[31mCould not find gem 'sdoc <= 0.3.20) x86-mingw32' in the gems available on this machine.<[0m
<[31mRun 'bundle install' to install missing gems.<[0m
And there is the joke, how can I use "bundle install" if it's not working? :(
Every help is appreciated, I'm a bloody beginner in setting up development enviorments. If you need any additional information, I will provide them as soon as I can get them!
Edit:
Content of gem_make.out:
"D:/Program Files (x86)/Ruby 1.9.3/bin/ruby.exe" extconf.rb
D:/Program Files (x86)/Ruby 1.9.3/bin/ruby.exe: invalid switch in RUBYOPT: -F (RuntimeError)
I installed Ruby 1.9.3 manually using the Rubyinstaller because the Railsinstaller didn't work for me (it nearly put the same error if I wanted to get JSON!). Then I did an update to install DevKit, and used gem install rails to get rails.
Zerotime
Note: English isn't my native language, don't feel bothered by mistakes :)
Related
Trying to reinstall rails after removing all local gems i'm getting the following error:
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
current directory: C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/websocket-driver-0.7.5/ext/websocket-driver
C:/Ruby30-x64/bin/ruby.exe -I C:/Ruby30-x64/lib/ruby/site_ruby/3.0.0 -r ./siteconf20220903-5400-zth3ct.rb extconf.rb
creating Makefile
current directory: C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/websocket-driver-0.7.5/ext/websocket-driver
make DESTDIR\= clean
current directory: C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/websocket-driver-0.7.5/ext/websocket-driver
make DESTDIR\=
make failedNo such file or directory - make
Gem files will remain installed in C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/websocket-driver-0.7.5 for inspection.
Results logged to C:/Ruby30-x64/lib/ruby/gems/3.0.0/extensions/x64-mingw32/3.0.0/websocket-driver-0.7.5/gem_make.out
Recently I changed my motherboard but still it's the same SSD and previously this problem never happened and Ruby is running normally;
I've already tried to reinstall MinGW, Is there other option I can try?
Thanks in advance
The specific error reason is contained in the message you posted, it's just a little bit hidden within the context:
make failedNo such file or directory - make
It seems your system doesn't have the make lib installed. A similar question had it solved by installing the whole MSYS2 and MINGW development toolchain:
ridk install
then options:
[1,3]
You have a system ruby installed so you have to uninstall it, then install rvm as an ordinary user and install ruby using rvm Be sure to use the same ruby version referred to in your Gemfile, Gemfile.lock or .ruby-version You may want to delete Gemfile.lock and .ruby-version, especially .ruby-version because that can persist errors over version changes until you delete it
I am working on multiple Ruby on Rails applications and running...
MacOS 10.15.7,
Ruby 2.6.5,
Rails 5.2.3,
In a project app directory I am trying to run a bundle install and get the following error:
An error occurred while installing jaro_winkler (1.5.3), and Bundler cannot continue.
Make sure that `gem install jaro_winkler -v '1.5.3' --source
'https://.../api/gems/rubygems/'` succeeds before bundling.
I proceed to install the gem from the specified source and get confirmation of install
Building native extensions. This could take a while...
Successfully installed jaro_winkler-1.5.3
Parsing documentation for jaro_winkler-1.5.3
Done installing documentation for jaro_winkler after 0 seconds
1 gem installed
after running bundle install again, I will get the original error
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/private/var/folders/yr/dw4ljvv14cl9vp76jt_6zqrsv1qhkf/T/bundler20210406-62421-1bm7o1ijaro_winkler-1.5.3/gems/jaro_winkler-1.5.3/ext/jaro_winkler
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r
./siteconf20210406-62421-10txxc5.rb extconf.rb
creating Makefile
current directory:
/private/var/folders/yr/dw4ljvv14cl9vp76jt_6zqrsv1qhkf/T/bundler20210406-62421-1bm7o1ijaro_winkler-1.5.3/gems/jaro_winkler-1.5.3/ext/jaro_winkler
make "DESTDIR=" clean
current directory:
/private/var/folders/yr/dw4ljvv14cl9vp76jt_6zqrsv1qhkf/T/bundler20210406-62421-1bm7o1ijaro_winkler-1.5.3/gems/jaro_winkler-1.5.3/ext/jaro_winkler
make "DESTDIR="
make: *** No rule to make target
`/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/universal-darwin19/ruby/config.h',
needed by `adj_matrix.o'. Stop.
make failed, exit code 2
Gem files will remain installed in
/var/folders/yr/dw4ljvv14cl9vp76jt_6zqrsv1qhkf/T/bundler20210406-62421-1bm7o1ijaro_winkler-1.5.3/gems/jaro_winkler-1.5.3
for inspection.
Results logged to
/var/folders/yr/dw4ljvv14cl9vp76jt_6zqrsv1qhkf/T/bundler20210406-62421-1bm7o1ijaro_winkler-1.5.3/extensions/universal-darwin-19/2.6.0/jaro_winkler-1.5.3/gem_make.out
An error occurred while installing jaro_winkler (1.5.3), and Bundler cannot continue.
Make sure that `gem install jaro_winkler -v '1.5.3' --source
'https://.../api/gems/rubygems/'` succeeds before bundling.
The error message above doesn't give me any clear indication of what is happening. Additionally there is no such directory in the location where the message says "results logged to."
This seems to be happening in multiple application directories - but with different affected gems in each directory. They are all similar in that the error reads "make sure gem succeeds before bundling", then the gem install will succeed, and then the following bundle install will fail with the same original message.
Earlier today I did a clean Ruby 2.6.5 install and updated the Xcode CLI via xcode-select --install
If I run gem which jaro_winkler I get
/Users/{username}/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/jaro_winkler-1.5.3/lib/jaro_winkler.rb
Does anyone have any information on what could be causing this? I cannot do any bundle install without this happening. Please let me know if any more information is desired.
Thank you!
You mentioned that you are using ruby 2.6.5, but the gem is attempting to be installed in 2.6.0. Check that your Gemfile has the correct Ruby version in it.
When you ran gem which, it looks you are using rbenv. Make sure that you are using the correct Ruby version in there, too. Those rubies get installed in a different directory than xcode's. Sometimes there's a .rbenv file in the dir that will set the version as well.
Just some ideas. Hopefully something sticks.
Ended up being an issue with gem install location - export PATH="/usr/local/bin:$PATH" was previously added to my .bash_profile and this was effecting where gems were installed.
Somewhere in the error message /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby is mentioned - this is the "system default" Mac version of Ruby and is not the Ruby version I was intending to use with .rbenv ( 2.6.5 ) and gem installs.
Removing the export mentioned above help resolve the issue.
edit- wording
I know it said not to move it, but after I did ruby dk.rb init and ruby dk.rb install I moved it to a different directory because I didn't want it to clutter the directory it was in. I was able to gem install json before, but now when I try to test if it works by running gem install json --platform=ruby I get the following error:
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
C:/Ruby200-x64/bin/ruby.exe extconf.rb
creating Makefile
make "DESTDIR="
Gem files will remain installed in C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/json-1.8.1 for inspection.
Results logged to C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/json-1.8.1/ext/jsln/ext/generator/gem_make.out
How would I go about solving this?
reinstall. from your console, go to the path where you now have the devkit
D:\stuff\devkit
ruby dk.rb init - then open up the config.yml file that lives in that directory... make sure it's pointing to your ruby installation
ruby dk.rb install
https://github.com/oneclick/rubyinstaller/wiki/Development-Kit
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.
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
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.
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.
I know other people have asked this but the suggested fixes don't seem to work for me. I'm trying to install Rails v. 3.2.3 on a Mac OS X Lion, using Ruby 1.8.7. In terminal:
$ sudo gem install rails -v 3.2.3
And then I get the error message:
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/json-1.7.0 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/json-1.7.0/ext/json/ext/parser/gem_make.out
I've seen some people suggest installing Xcode v. 4.3.2, which I have, but I'm not sure if I need to do something special with Xcode to get the Rails installation to work. Any help is appreciated.
The easiest install way is by using RVM
here is a pretty good guide:
http://thinkvitamin.com/code/ruby-on-rails/installing-ruby-rails-and-mysql-on-os-x-lion/