I'm fairly new to rails. This may be a dumb question, but I can't seem to find a solution. Any suggestion is greatly appreciated.
I've just cloned a repository and I'm running "bundle install". I initially received a general error message regarding "rb-fsevent"when I ran "bundle install". I then just tried to install "rb-fsevent" individually, but received the following error message: (unfortunately I don't have enough reputation to post images...)
An error occurred while installing rb-fsevent (0.4.3.1), and Bundler cannot continue.
Make sure that gem install rb-fsevent -v '0.4.3.1' succeeds before bundling.
dhcp-50-74:sample_app SJ$ gem install rb-fsevent -v '0.4.3.1'
Building native extensions. This could take a while...
ERROR: Error installing rb-fsevent:
ERROR: Failed to build gem native extension.
/Users/SJ/.rvm/rubies/ruby-2.1.1/bin/ruby extconf.rb
creating Makefile
extconf.rb:21:in `': Only Darwin systems greater than 8 (Mac OS X 10.5+) are supported (RuntimeError)
extconf failed, exit code 1
The error message seems to suggest my Mac system is not 10.5+, however, I'm using a MacbookPro running Mavericks OS X 10.9.2.
First of all, read about fsevents here to know what it actually does.
The gem you're trying to install depends on native OSX libraries and you don't seem to be able to build 'em. Try installing command line tools for OSX and install the gem again.
Here's a good tutorial on how to install command line tools:
UPDATE
This was raised as an issue and the fix is to uninstall the previous version and install version 0.9.
gem install 'rb-fsevent' -v '0.9'
or update the gem dependency in your Gemfile:
gem 'rb-fsevent', '>= 0.9'
Related
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'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
I have an app on the Heroku Bamboo stack and have been following the instructions here (https://devcenter.heroku.com/articles/cedar-migration) for migrating to the Cedar stack.
My app has an older version of RefineryCMS (1.0.3) and I'm trying to avoid dealing with an upgrade there (for now), and so I've kept Rails at 3.0.9. Still, Ruby 1.8.7 is past EOL, so I needed to upgrade that at least. I specified 1.9.3 in my Gemfile, thus:
source "https://rubygems.org"
ruby "1.9.3"
And then I attempted to bundle install. Here's my output from that attempt:
Fetching gem metadata from https://rubygems.org/..........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies....
Using rake 0.8.7
Installing RedCloth 4.2.7 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/day/.rvm/rubies/ruby-1.9.3-p551/bin/ruby -r ./siteconf20151105-14593-x80q4a.rb extconf.rb
checking for main() in -lc... no
creating Makefile
make clean
make
compiling redcloth_attributes.c
ragel/redcloth_attributes.c.rl: In function 'redcloth_attribute_parser':
ragel/redcloth_attributes.c.rl:26:11: error: variable 'act' set but not used [-Werror=unused-but-set-variable]
ragel/redcloth_attributes.c.rl: In function 'redcloth_attributes':
ragel/redcloth_attributes.c.rl:45:3: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
ragel/redcloth_attributes.c.rl: In function 'redcloth_link_attributes':
ragel/redcloth_attributes.c.rl:54:3: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
cc1: all warnings being treated as errors
make: *** [redcloth_attributes.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/day/.rvm/gems/ruby-1.9.3-p551/gems/RedCloth-4.2.7 for inspection.
Results logged to /Users/day/.rvm/gems/ruby-1.9.3-p551/extensions/x86_64-darwin-14/1.9.1/RedCloth-4.2.7/gem_make.out
An error occurred while installing RedCloth (4.2.7), and Bundler cannot continue.
Make sure that `gem install RedCloth -v '4.2.7'` succeeds before bundling.
Needless to say gem install RedCloth -v '4.2.7' resulted in the same error.
I found this question, Failed to build gem native extension when install RedCloth-4.2.9 install Linux, however, my issue was with RedCloth 4.2.7 (not 4.2.9) and I'm running OSX Yosemite (not Linux). There was an answer there which pertained to OSX Mountain Lion though, and I thought it was worth a try:
rvm --force install 1.9.2
gem install bundle --no-ri --no-rdoc
bundle install
Obviously, I changed 1.9.2 to 1.9.3 for my purposes, and I omitted the --no-ri --no-rdoc flags. Sadly, bundle install continued to fail with the same error.
Continuing my search online, I found this article, Install RedCloth 4.2.7 gem with bundler (using ruby enterprise edition 1.8.7). Not dissuaded by the version mismatch (again, I'm using Ruby 1.9.3, not 1.8.7), I decided to try the advice I found there, to wit:
bundle config build.RedCloth --with-cflags=-w
bundle install
This time, oh joy! it worked! And I'm on to whatever's next. I thought I would share this little journey here for any others who find themselves in the same predicament. Cheers!
I was able to resolve this issue by specifying extra build options for Bundler which are applied when building RedCloth, as follows:
bundle config build.RedCloth --with-cflags=-w
bundle install
When I run a bundle on a rails project I seem to be getting the following:
Installing pg 0.17.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r
./siteconf20151024-43303-t81fnp.rb extconf.rb checking for
pg_config... yes Using config values from /usr/local/bin/pg_config An
error occurred while installing pg (0.17.1), and Bundler cannot
continue. Make sure that gem install pg -v '0.17.1' succeeds before
bundling.
I have visited the following SO questions:
An error occurred while installing pg (0.17.1), and Bundler cannot continue
Installing pg -v 0.17.1
Installing PG gem on OS X - failure to build native extension.
Additionally to this I've tried executing the following:
gem install pg
env ARCHFLAGS="-arch x86_64" gem install pg
gem install pg -- --with-pg-config=/usr/local/Cellar/postgresql/9.4.5/bin/pg_config
And I keep getting:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
FYI I have rbenv installed too. Also tried a rbenv rehash also and executed the above commands and have had no luck. I've also tried uninstalling and reinstalling Postgres and get the same. To also be on the safe side i've also ran:
brew update
brew uinstall posgresql > brew install postgresql
updated Xcode
Info:
Mac OSx Yosemite 10.10.5
Postgres v9.4.5
rbenv v0.4.0
rbenv global => 2.0.0-p247
I don't know Mac, but I've had this problem on Windows.
--
The issue is here:
Failed to build gem native extension
When you install a gem, many of the advanced ones actually compile / "build" through the extconf.rb file. I've forgotten the significance of this, but it basically allows the gem to run natively on the OS environment you're using.
In short, the error occurs because your OS does not have access to the "developer headers" the gem requires to compile.
The most common instance of this problem is with the mysql2 gem on Windows, but happens for others too.
--
What you need is to download PGSQL on your system before attempting to install the gem.
After installing PGSQL, you may need to reference the developer headers with some "switches", but it does not appear to be the case in this instance:
Installing PG gem on OS X - failure to build native extension
Install Xcode command line tools (Apple Developer site)
brew uninstall postgresql
brew install postgresql
ARCHFLAGS="-arch x86_64" gem install pg
Maybe this won't work? I don't know... I know that in Windows, you have to install the binaries before expecting the gem to work.
Greetings I hope I can help. May I ask how you created your rails project? Did you simply use:
rails new *appname*
If so maybe try creating a new rails app like so:
rails new *appname* -d postgresql
And before you create your database and run migrations/seed, you should go into "config/database.yml" and change the username and password to the postgreSQL user that you've hopefully setup after installing postgreSQL on your machine.
Good Luck!
I was able to install the rmagick-2.6.0-x86-mswin32.gem gem in my windows 7 machine using gem install command and I got the following success messages:
D:\dev>gem install rmagick-2.6.0
Successfully installed rmagick-2.6.0-x86-mswin32
1 gem installed
Installing ri documentation for rmagick-2.6.0-x86-mswin32...
Installing RDoc documentation for rmagick-2.6.0-x86-mswin32...
But when I try to install using bundle install (with the same version mentioned in the Gemfile) it throws the following error messages:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension
. D:/Ruby187/bin/ruby.exe extconf.rb
checking for Ruby version >= 1.8.2... yes
checking for gcc... yes
checking for Magick-config... no
Can't install RMagick 2.6.0. Can't find Magick-config in D:\Ruby187\bin;D:\Ruby1
....
I already have ImageMagick installed and its paths included in the env vars, but the paths mentioned in the error message above seem to be different somehow(?!)
When i type rails -v now, I get the following message:
D:\dev>rails -v
←[31mCould not find gem 'rmagick (= 2.6.0) x86-mingw32' in the gems available on
this machine.←[0m
←[33mRun `bundle install` to install missing gems.←[0m
Do i need to make any other changes/ setups to install this gem with my gemfile using bundle install?
Also I actually need an earlier gem '2.5.2' but the win32 specific version of that gem does not seem to available, is there any way to get it?
I need to do this development on windows for the moment so I can switch to any other OS for the moment. Also since this is a legacy app I am working on, I will need to stick with rmagick and can't switch to any other solution.
Env info:
Ruby: 1.8.7
Rails:
Please help!
Many thanks.
Hey have you tried installing Devkit, for installing gems with native extensions on windows.
Try the steps in the following link, and check whether the Devkit has been installed in your path variable, try opening a new command shell and install the gems.
http://doelsengupta.blogspot.in/2010/10/unable-to-download-gem-with-native.html
all the best!!
I kept having this problem but was finally able to get around it using the following solution from #Martin Cohen - after modifying the gemspec file as he has suggested and rebuilding it, i was able to successfully install rmagick gem using bundle install...
https://stackoverflow.com/a/5595274/1865578
cheers!