前提・実現したいこと
railsアプリでboostrapの活用をしたい
→udemyを活用しrailsアプリを作成しているのですが、boostrapを活用するコードをgemfileに記載後bundler installをした際にエラーが発生しております。
発生している問題・エラーメッセージ
(省略) Installing libv8 3.16.14.19 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. (省略) An error occurred while installing libv8 (3.16.14.19), and Bundler cannot continue. Make sure that `gem install libv8 -v '3.16.14.19' --source 'https://rubygems.org/'` succeeds before bundling. (省略) In Gemfile: therubyracer was resolved to 0.12.3, which depends on libv8
該当のソースコード
Dokusho % sudo bundler install Password: Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine. The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`. Fetching gem metadata from https://rubygems.org/............ Fetching gem metadata from https://rubygems.org/. Resolving dependencies... Using rake 13.0.1 Using concurrent-ruby 1.1.5 Using i18n 1.8.2 Using minitest 5.14.0 Using thread_safe 0.3.6 Using tzinfo 1.2.6 Using zeitwerk 2.2.2 Using activesupport 6.0.2.1 Using builder 3.2.4 Using erubi 1.9.0 Using mini_portile2 2.4.0 Using nokogiri 1.10.7 Using rails-dom-testing 2.0.3 Using crass 1.0.6 Using loofah 2.4.0 Using rails-html-sanitizer 1.3.0 Using actionview 6.0.2.1 Using rack 2.1.1 Using rack-test 1.1.0 Using actionpack 6.0.2.1 Using nio4r 2.5.2 Using websocket-extensions 0.1.4 Using websocket-driver 0.7.1 Using actioncable 6.0.2.1 Using globalid 0.4.2 Using activejob 6.0.2.1 Using activemodel 6.0.2.1 Using activerecord 6.0.2.1 Using mimemagic 0.3.3 Using marcel 0.3.3 Using activestorage 6.0.2.1 Using mini_mime 1.0.2 Using mail 2.7.1 Using actionmailbox 6.0.2.1 Using actionmailer 6.0.2.1 Using actiontext 6.0.2.1 Using public_suffix 4.0.3 Using addressable 2.7.0 Using bindex 0.8.1 Using msgpack 1.3.1 Using bootsnap 1.4.5 Using bundler 1.17.2 Using byebug 11.0.1 Using regexp_parser 1.6.0 Using xpath 3.2.0 Using capybara 3.30.0 Using childprocess 3.0.0 Using commonjs 0.2.7 Using execjs 2.7.0 Using ffi 1.12.1 Using jbuilder 2.9.1 Using less 2.6.0 Using sprockets 4.0.0 Using less-rails 4.0.0 Fetching libv8 3.16.14.19 Installing libv8 3.16.14.19 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /Library/Ruby/Gems/2.6.0/gems/libv8-3.16.14.19/ext/libv8 /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 ./siteconf20200119-55130-fgb1f.rb extconf.rb creating Makefile Applying /Library/Ruby/Gems/2.6.0/gems/libv8-3.16.14.19/patches/disable-building-tests.patch Applying /Library/Ruby/Gems/2.6.0/gems/libv8-3.16.14.19/patches/disable-werror-on-osx.patch Applying /Library/Ruby/Gems/2.6.0/gems/libv8-3.16.14.19/patches/disable-xcode-debugging.patch Applying /Library/Ruby/Gems/2.6.0/gems/libv8-3.16.14.19/patches/do-not-imply-vfp3-and-armv7.patch Applying /Library/Ruby/Gems/2.6.0/gems/libv8-3.16.14.19/patches/do-not-use-MAP_NORESERVE-on-freebsd.patch Applying /Library/Ruby/Gems/2.6.0/gems/libv8-3.16.14.19/patches/do-not-use-vfp2.patch Applying /Library/Ruby/Gems/2.6.0/gems/libv8-3.16.14.19/patches/fPIC-for-static.patch Compiling v8 for x64 Using python 2.7.16 Using compiler: c++ (clang version 11.0.0) Unable to find a compiler officially supported by v8. It is recommended to use GCC v4.4 or higher Beginning compilation. This will take some time. Building v8 with env CXX=c++ LINK=c++ /usr/bin/make x64.release ARFLAGS.target=crs werror=no GYP_GENERATORS=make \ build/gyp/gyp --generator-output="out" build/all.gyp \ -Ibuild/standalone.gypi --depth=. \ -Dv8_target_arch=x64 \ -S.x64 -Dv8_enable_backtrace=1 -Dv8_can_use_vfp2_instructions=true -Darm_fpu=vfpv2 -Dv8_can_use_vfp3_instructions=true -Darm_fpu=vfpv3 -Dwerror='' CXX(target) /Library/Ruby/Gems/2.6.0/gems/libv8-3.16.14.19/vendor/v8/out/x64.release/obj.target/preparser_lib/src/allocation.o warning: include path for stdlibc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found] In file included from ../src/allocation.cc:33: ../src/utils.h:33:10: fatal error: 'climits' file not found #include <climits> ^~~~~~~~~ 1 warning and 1 error generated. make[1]: *** [/Library/Ruby/Gems/2.6.0/gems/libv8-3.16.14.19/vendor/v8/out/x64.release/obj.target/preparser_lib/src/allocation.o] Error 1 make: *** [x64.release] Error 2 /Library/Ruby/Gems/2.6.0/gems/libv8-3.16.14.19/ext/libv8/location.rb:36:in `block in verify_installation!': libv8 did not install properly, expected binary v8 archive '/Library/Ruby/Gems/2.6.0/gems/libv8-3.16.14.19/vendor/v8/out/x64.release/obj.target/tools/gyp/libv8_base.a'to exist, but it was not found (Libv8::Location::Vendor::ArchiveNotFound) from /Library/Ruby/Gems/2.6.0/gems/libv8-3.16.14.19/ext/libv8/location.rb:35:in `each' from /Library/Ruby/Gems/2.6.0/gems/libv8-3.16.14.19/ext/libv8/location.rb:35:in `verify_installation!' from /Library/Ruby/Gems/2.6.0/gems/libv8-3.16.14.19/ext/libv8/location.rb:26:in `install!' from extconf.rb:7:in `<main>' extconf failed, exit code 1 Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/libv8-3.16.14.19 for inspection. Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/libv8-3.16.14.19/gem_make.out An error occurred while installing libv8 (3.16.14.19), and Bundler cannot continue. Make sure that `gem install libv8 -v '3.16.14.19' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile: therubyracer was resolved to 0.12.3, which depends on libv8
試したこと
1:以下のエラーメッセージを元にgem install libv8 -v '3.16.14.19' --source 'https://rubygems.org/'を実行
% gem install libv8 -v '3.16.14.19' --source 'https://rubygems.org/'
succeeds before
bundling.`
結果以下のエラーメッセージが出現
Dokusho % sudo gem install libv8 -v '3.16.14.19' --source 'https://rubygems.org/' Building native extensions. This could take a while... ERROR: Error installing libv8: ERROR: Failed to build gem native extension.
2:1のエラーメッセージを元にリンク先のコードを実行
Dokusho % sudo gem install libv8 -v '3.16.14.19' --source 'https://rubygems.org/' Building native extensions. This could take a while... ERROR: Error installing libv8: ERROR: Failed to build gem native extension.
参照リンク
https://haayaaa.hatenablog.com/entry/2019/05/16/210402
$ brew install v8-315 $ bundle config --local build.libv8 --with-system-v8 You are replacing the current local value of build.libv8, which is currently nil
上記2つは実行成功。以下コマンドを打った際にエラーメッセージが出現
$bundle config --local build.therubyracer --with-v8-dir=(brew --prefix v8-315) zsh: unknown file attribute: b
補足情報(FW/ツールのバージョンなど)
OS:macOS Catalina 10.15
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
rbenv 1.1.2
初心者のため、現在行っている解決策が間違っていたり、頂戴した回答への追加質問をすることもあるかもしれませんがよろしくお願いいたします。
あなたの回答
tips
プレビュー