rails bundle install error therubyracer - ruby-on-rails

i tried installing the gem separately and v8 file also. I'm lost on what to do as I've exhausted all possible options
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/giowong/.rbenv/versions/2.1.3/bin/ruby extconf.rb
checking for main() in -lpthread... yes
checking for main() in -lobjc... yes
checking for v8.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/giowong/.rbenv/versions/2.1.3/bin/ruby
--with-pthreadlib
--without-pthreadlib
--with-objclib
--without-objclib
--enable-debug
--disable-debug
--with-v8-dir
--without-v8-dir
--with-v8-include
--without-v8-include=${v8-dir}/include
--with-v8-lib
--without-v8-lib=${v8-dir}/lib
/Users/giowong/rails_project/doctible_pre_treatment/vendor/bundle/ruby/2.1.0/gems/libv8-3.16.14.3/ext/libv8/location.rb:50:in `configure': You have chosen to use the version of V8 found on your system (Libv8::Location::System::NotFoundError)
and *not* the one that is bundle with the libv8 rubygem. However,
it could not be located. please make sure you have a version of
v8 that is compatible with 3.16.14.3 installed. You may
need to special --with-v8-dir options if it is in a non-standard
location
thanks,
The Mgmt
from /Users/giowong/rails_project/doctible_pre_treatment/vendor/bundle/ruby/2.1.0/gems/libv8-3.16.14.3/lib/libv8.rb:7:in `configure_makefile'
from extconf.rb:32:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/giowong/rails_project/doctible_pre_treatment/vendor/bundle/ruby/2.1.0/gems/therubyracer-0.12.1 for inspection.
Results logged to /Users/giowong/rails_project/doctible_pre_treatment/vendor/bundle/ruby/2.1.0/extensions/x86_64-darwin-14/2.1.0-static/therubyracer-0.12.1/gem_make.out
An error occurred while installing therubyracer (0.12.1), and Bundler cannot
continue.
Make sure that `gem install therubyracer -v '0.12.1'` succeeds before bundling.
I'm using brew to install ruby and rails using this setup guide
https://gorails.com/setup/osx/10.10-yosemite
Help please, upgrading to Yosemite has totally messed with my dev environment

Perhaps this problem has to do with a recent update of XCode. After a XCode update you need to do the following steps:
Open Xcode and accept the license agreement
Reinstall the Command Line Tools.
The second step seems to depend on your OS versions. If xcode-select --install does not work try to start the Install Command Line Developer Tools app in /System/Library/CoreServices.
After reinstalling the Command Line Tools try to rerun bundle install.

Try this worked for me:
gem install libv8 -- --with-system-v8
gem install therubyracer -v '0.12.1'
if that didn't work try to run:
brew update
and try again the first two steps.

I resolved the same issue by changing the Gemfile
gem 'therubyracer'
was replaced by
gem 'therubyracer', platforms: :ruby
Could you try this?

This worked for Catalina
brew install v8#3.15
gem install libv8 -v 3.16.14.19 -- --with-system-v8
gem install therubyracer -- --with-v8-dir=/usr/local/opt/v8#3.15
Source

Related

Bundle Install / TheRubyRacer gem cannot be installed on MacOS Catalina 10.15.2

I'm getting tired of error when trying to bundle install and install therubyracer.
I've tried everything from around the net and nothing helps.
Already installed libv8 and x-code setup.
Appreciate your help!
After command sudo gem install therubyracer -v '0.12.3', I'm receivin error:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.6.0/gems/therubyracer-0.12.3/ext/v8
/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 ./siteconf20191219-41979-115mu26.rb extconf.rb
checking for -lpthread... yes
checking for -lobjc... yes
checking for v8.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/$(RUBY_BASE_NAME)
--with-pthreadlib
--without-pthreadlib
--with-objclib
--without-objclib
--enable-debug
--disable-debug
--with-v8-dir
--without-v8-dir
--with-v8-include
--without-v8-include=${v8-dir}/include
--with-v8-lib
--without-v8-lib=${v8-dir}/lib
/Library/Ruby/Gems/2.6.0/gems/libv8-3.16.14.19/ext/libv8/location.rb:50:in `configure': By using --with-system-v8, you have chosen to use the version (Libv8::Location::System::NotFoundError)
of V8 found on your system and *not* the one that is bundled with
the libv8 rubygem.
However, your system version of v8 could not be located.
Please make sure your system version of v8 that is compatible
with 3.16.14.19 installed. You may need to use the
--with-v8-dir option if it is installed in a non-standard location
from /Library/Ruby/Gems/2.6.0/gems/libv8-3.16.14.19/lib/libv8.rb:7:in `configure_makefile'
from extconf.rb:32:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/therubyracer-0.12.3/mkmf.log
extconf failed, exit code 1 ```
I've found the solution for this error.
If you have a problem with bundle install check this:
gem list libv8 --remote --all
gem install libv8 -v 3.16.14.19 -- --with-system-v8
gem install therubyracer -- --with-v8-dir=/Users/YOUR_NAME/homebrew/opt/v8#3.15
It works for me, after few hours of fighting with every solution I can find.
Hope it'll help someone.
I was stuck on the same issue and got help from this gist.
brew install v8#3.15
gem install libv8 -v 'YOUR_VERSION' -- --with-system-v8
gem install therubyracer -v 'YOUR_VERSION' -- --with-v8-dir=/usr/local/opt/v8#3.15
bundle install
I am using macOS Catalina version 10.15.3 and ruby version 2.6.3. I hope it helps!
I have faced the same issue recently in Mac OS 10.15.7
brew install v8-315
gem install libv8 -v '3.16.14.19' -- --with-system-v
gem install therubyracer -v '0.12.3' -- --with-system-v8 --with-v8-dir=/usr/local/opt/v8#3.15
Note: while installing ruby race it installed only after putting both the options together --with-system-v8 and --with-v8-dir and pointing to that directory.
Please do verify if the folder exist in that path or not before installing.
Uninstalling v8 and install v8#3.15 on a fresh Catalina install worked for me.
$ brew uninstall v8
$ brew install v8#3.15

Rails on WINDOWS: install therubyracer & libv8 - working on a website designed on MAC

I have a website developed with was RoR v 4.2.4 on MAC which needs some adaptions and I'm trying to get in running on my windows 10 (because I don't have a MAC).I was not successfull with the rails installer and rails 5.0.
After a lot of pain installing RoR 4.2.4 with ruby 2.2.6 I managed to install nearly all missing gems using bundle check, bundle install and gem install xyz -v 0.0.... But now I'm really stuck with the last 2:
therubyracer and libv8
What I tried:
Install libv8 with gem install libv8 -v 3.16.14.11 -- --with-system-v8 and also the therubyracer-for-windows which is mentioned here.
Modify the gemfile.lock to get rid of the dependencies like:
group :production do
gem 'therubyracer'
end
and tried bundle install --without production. But then I get an error when starting the server.
At the moment bundle check says that therubyracer v 0.12.2 is the last missing gem. libv8 is installed with --with-system-v8. gem list says libv8 (3.16.14.11) and therubyracer (0.11.0b) is installed but the systems does not seems to find therubyracer because: therubyracer -v does not work. Furthermore bundle install give me the follwing error:
C:/Ruby22-x64/bin/ruby.exe -r ./siteconf20170122-10664-jwvn48.rb extconf.rb
--with-v8-dir=/usr/local/opt/v8-315
checking for main() in -lpthread... yes
checking for v8.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/Ruby22-x64/bin/$(RUBY_BASE_NAME)
--with-pthreadlib
--without-pthreadlib
--enable-debug
--disable-debug
--with-v8-dir
--with-v8-include
--without-v8-include=${v8-dir}/include
--with-v8-lib
--without-v8-lib=${v8-dir}/lib
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/libv8-3.16.14.11/ext/libv8/location.rb:50:in
`configure': You have chosen to use the version of V8 found on your system
(Libv8::Location::System::NotFoundError)
and *not* the one that is bundle with the libv8 rubygem. However,
it could not be located. please make sure you have a version of
v8 that is compatible with 3.16.14.11 installed. You may
need to special --with-v8-dir options if it is in a non-standard
location
thanks,
The Mgmt
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/libv8-3.16.14.11/lib/libv8.rb:7:in
`configure_makefile'
from extconf.rb:32:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/therubyracer-0.12.2 for inspection.
Results logged to
C:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0/therubyracer-0.12.2/gem_make.out
An error occurred while installing therubyracer (0.12.2), and Bundler cannot
continue.
Make sure that `gem install therubyracer -v '0.12.2'` succeeds before bundling.
This error is at least similar to all the ones I get before, when trying to install therubyracer after I installed libv8 with --with-system-v8.
Sorry if this information is a bit chaotic, but I tried so many things over about a day now and was not always 100% sure what I doing :)...quite hard to summarizes as much as possible. If there is important information missing, let me know.
By the way: I followed this guide as good as possible. Creating/Developping a new website with rails new blog and running the server for it works perfectly...the problem is only with the existing website I have to complete.
Can someone help me? Is there any way to get the website running on my windows pc? Thanks!

Error installing nokogiri: Failed to build gem native extension & libiconv is missing (OSX)

I try to clone this repo and run bundle install. The bundle process failed and throw this error:
...
Installing nokogiri 1.6.2.1 with native extensions
Building nokogiri using packaged libraries.
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/zulhilmizainudin/.rvm/rubies/ruby-2.2.0/bin/ruby -r ./siteconf20151130-43880-pntnc6.rb extconf.rb
Building nokogiri using packaged libraries.
-----
libiconv is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/zulhilmizainudin/.rvm/rubies/ruby-2.2.0/bin/$(RUBY_BASE_NAME)
--help
--clean
--use-system-libraries
--enable-static
--disable-static
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--enable-cross-build
--disable-cross-build
extconf failed, exit code 1
Gem files will remain installed in /Users/zulhilmizainudin/.rvm/gems/ruby-2.2.0/gems/nokogiri-1.6.2.1 for inspection.
Results logged to /Users/zulhilmizainudin/.rvm/gems/ruby-2.2.0/extensions/x86_64-darwin-14/2.2.0-static/nokogiri-1.6.2.1/gem_make.out
An error occurred while installing nokogiri (1.6.2.1), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.2.1'` succeeds before bundling.
Then I try to run this:
gem install nokogiri -v '1.6.2.1'
And now I get this error:
Building native extensions. This could take a while...
Building nokogiri using packaged libraries.
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/zulhilmizainudin/.rvm/rubies/ruby-2.2.0/bin/ruby -r ./siteconf20151130-43942-1axq4sj.rb extconf.rb
Building nokogiri using packaged libraries.
-----
libiconv is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/zulhilmizainudin/.rvm/rubies/ruby-2.2.0/bin/$(RUBY_BASE_NAME)
--help
--clean
--use-system-libraries
--enable-static
--disable-static
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--enable-cross-build
--disable-cross-build
extconf failed, exit code 1
Gem files will remain installed in /Users/zulhilmizainudin/.rvm/gems/ruby-2.2.0/gems/nokogiri-1.6.2.1 for inspection.
Results logged to /Users/zulhilmizainudin/.rvm/gems/ruby-2.2.0/extensions/x86_64-darwin-14/2.2.0-static/nokogiri-1.6.2.1/gem_make.out
I tried to follow this answer but I still get the same error above.
I also try to uninstall and install my brew again (based on this answer) and it's still same.
Also, I try this solution but still get the error.
What should I do now to make sure this nokogiri gem installed successfully?
Note: I'm using OSX 10.11.1 El Capitan.
Run these commands:
gem uninstall nokogiri
xcode-select --install
gem install nokogiri
source: http://www.nokogiri.org/tutorials/installing_nokogiri.html#mac_os_x
sometimes mac updates can break xcode CLI so reinstalling can fix the issue:
https://github.com/sparklemotion/nokogiri/issues/1445
What worked for me (on macOS Sierra) was a combination of Sam's answer and the following:
gem install nokogiri -- --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/libxml2 --use-system-libraries
I had a similar issue with 1.6.7.2 when bundle installing on codeship with ruby 2.3.
What worked for me was adding:
bundle config build.nokogiri --use-system-libraries
before
bundle install
If you're using bundle:
brew install libxml2
# If using Bundle
bundle config build.nokogiri --use-system-libraries \
--with-xml2-include=$(brew --prefix libxml2)/include/libxml2
bundle install
from http://www.nokogiri.org/tutorials/installing_nokogiri.html
Try this
sudo apt-get install build-essential patch ruby-dev zlib1g-dev liblzma-dev
And then install Nokogiri
sudo gem install nokogiri
I did everything in the other answers, but had to do one more thing:
Open Xcode
Click "Agree"
Wait a bit, close Xcode
Rejoice
Seems like this is due to nokogiri 1.6.2.1 specific problem.
I add this inside my Gemfile:
gem 'nokogiri', '~> 1.6', '>= 1.6.7'
And run bundle update nokogiri and then bundle. Everything now working fine.
It may also be an issue with the anaconda version of some of the libs.
$ conda deactivate
$ gem uninstall nokogiri
$ gem install nokogiri
$ conda activate base
worked for me.
I had the similar issue. The reason was outdated xcode.
If you run brew doctor you might see it. Just open AppStore, got to updates tab and update your xcode.
If nothing above works,
Try deleting Gemfile.lock, and do reinstalling of gems.
Spencer's answer worked for me, but I also needed to use the -n parameter to overcome the permission issue documented here.
So in the end, the command that worked for me was:
gem install -n /usr/local/bin nokogiri -- --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/libxml2 --use-system-libraries
Deleting nokogiri in rbenv gem folder and reinstalling solved it for me.
This helped me fix this
I reinstalled Xcode and directed xcode-select to its path
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
ref:
https://stackoverflow.com/a/17980786/3861525
I had the same issue while updating to xcode 10. I resolved it with the following steps :
xcode-select --install
bundle install --deployment
gem install nokogiri
Github Answer
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
bundle install

gem install therubyracer -v '0.12.0' on osx yosemite not working

Hi here is my console log,
Building native extensions. This could take a while...
ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
/Users/user/.rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb
checking for main() in -lpthread... yes
checking for main() in -lobjc... yes
checking for v8.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/user/.rvm/rubies/ruby-1.9.3-p448/bin/ruby
--with-pthreadlib
--without-pthreadlib
--with-objclib
--without-objclib
--enable-debug
--disable-debug
--with-v8-dir
--without-v8-dir
--with-v8-include
--without-v8-include=${v8-dir}/include
--with-v8-lib
--without-v8-lib=${v8-dir}/
/Users/user/.rvm/gems/ruby-1.9.3-p448#projVer2.3/gems/libv8-3.16.14.3/ext/libv8 /location.rb:50:in `configure': You have chosen to use the version of V8 found on your system (Libv8::Location::System::NotFoundError)
and *not* the one that is bundle with the libv8 rubygem. However,
it could not be located. please make sure you have a version of
v8 that is compatible with 3.16.14.3 installed. You may
need to special --with-v8-dir options if it is in a non-standard
location
thanks,
The Mgmt
from /Users/user/.rvm/gems/ruby-1.9.3-p448#projVer2.3/gems/libv8-3.16.14.3/lib/libv8.rb:7:in `configure_makefile'
from extconf.rb:32:in `<main>'
Gem files will remain installed in /Users/user/.rvm/gems/ruby-1.9.3-p448#projVer2.3/gems/therubyracer-0.12.1 for inspection.
Results logged to /Users/user/.rvm/gems/ruby-1.9.3-p448#projVer2.3/gems/therubyracer- 0.12.1/ext/v8/gem_make.out
FDLMC060:helpkit user$
I tried a lot of links which install libv8 via homebrew and then tried to install therubyracer but no help.
and i tried this link as well..
How to install therubyracer gem on 10.10 Yosemite?
but throwed errors while installing v8 itself.
The switch --with-system-v8 installs the libv8
but its not installing therubyracer -v '0.12.0'
OS -> OS X Yosemite
installed apple-gcc 4.2
and made export on CC,CXX
Please Help me to fix this.
Try to
gem install therubyracer -v '0.12.0' -- --with-v8-dir=/path/to/v8
But before you should have v8 installed on your system
Thanks #Stanislav for trying to help me.
I exactly did this at last,
Uninstalled all libv8 related gems using
"gem uninstall libv8 -a -x"
and then removed the Gemfile.lock using "rm -rf Gemfile.lock"
and tried
"bundle install"
it worked!!!!

Ruby Debugger installation Error

I am getting the following Error While installing ruby debugger
In gemfile i added
gem 'ruby-debug19', :require => 'ruby-debug'
and run
bundle install
Installing linecache19 (0.5.12) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for vm_core.h... no
checking for vm_core.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/bin/ruby
--with-ruby-dir
--without-ruby-dir
--with-ruby-include
--without-ruby-include=${ruby-dir}/include
--with-ruby-lib
--without-ruby-lib=${ruby-dir}/lib
What is the reason for the error
how to install thre debugger..???
You have to first set the path of DevKit in your environmental variable
Then run
gem install linecache19
gem install ruby-debug-base19
gem install ruby-debug-ide
through command prompt
May this work
From the RVM website:
If you have trouble installing ruby-debug19 try installing with the following command:
$ rvm reinstall 1.9.3 --patch debug --force-autoconf
$ gem install ruby-debug19 -- --with-ruby-include="${MY_RUBY_HOME/rubies/src}"
"On Ubuntu, the native compilation step downloads the ruby 1.9.2 source and tries to unpack it into a directory that your current user probably does not have write access to." - Darren (Reference: http://isitruby19.com/linecache19)
In this case, try sudo bundle install.
If the problem is that it cannot resolve the vm_core.h file dependency, you can run the installs with specific versions and the path to the ruby source:
sudo -E gem install linecache19 -v=0.5.11 -- --with-ruby-include=path_to/ruby-1.9.1-p378/
sudo -E gem install ruby-debug-base19 -v=0.11.23 -- --with-ruby-include=path_to/ruby-1.9.1-p378/
sudo -E gem install ruby-debug-ide -v=0.4.9 -- --with-ruby-include=path_to/ruby-1.9.1-p378/
Reference: http://isitruby19.com/linecache19
Note, replace path_to/ruby-1.9.1-p378/, with the path to where you installed ruby.
To find out where you installed ruby, try running:
which ruby

Resources