2014-12-02 52 views
8

所以我有這個問題libv8-3.16.14.3無法安裝,即使它欺騙性地告訴你它安裝。libv8-3.16.14.3無法安裝 - Rails 4.1.8

所以問題的第一個跡象是,當它做:

An error occurred while installing libv8 (3.16.14.3), and Bundler cannot continue. 
Make sure that `gem install libv8 -v '3.16.14.3'` succeeds before bundling. 

期間bundle install。所以我做了一些谷歌搜索和運行時整個this response裏面傳來:

gem install libv8 -v '3.16.14.3' -- --with-system-v8 
Building native extensions with: '--with-system-v8' 
This could take a while... 
Successfully installed libv8-3.16.14.3 
Parsing documentation for libv8-3.16.14.3 
Done installing documentation for libv8 after 1 seconds 
1 gem installed 

導致你想它的工作。但再次運行bundle install,看到有問題的錯誤是:

An error occurred while installing libv8 (3.16.14.3), and Bundler cannot continue. 
Make sure that `gem install libv8 -v '3.16.14.3'` succeeds before bundling. 

整個跟蹤日誌可以看到下面(通過運行bundle install引起):

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

    /Users/Adam/.rvm/rubies/ruby-2.1.5/bin/ruby extconf.rb 
creating Makefile 
Compiling v8 for x64 
Using python 2.7.6 
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 
Unable to find a compiler officially supported by v8. 
It is recommended to use GCC v4.4 or higher 
Using compiler: g++ 
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 
Unable to find a compiler officially supported by v8. 
It is recommended to use GCC v4.4 or higher 
../src/cached-powers.cc:136:18: error: unused variable 'kCachedPowersLength' [-Werror,-Wunused-const-variable] 
static const int kCachedPowersLength = ARRAY_SIZE(kCachedPowers); 
       ^
1 error generated. 
make[1]: *** [/Users/Adam/Dropbox/AisisGit/AisisPlatform/.bundle/gems/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/cached-powers.o] Error 1 
make: *** [x64.release] Error 2 
/Users/Adam/Dropbox/AisisGit/AisisPlatform/.bundle/gems/gems/libv8-3.16.14.3/ext/libv8/location.rb:36:in `block in verify_installation!': libv8 did not install properly, expected binary v8 archive '/Users/Adam/Dropbox/AisisGit/AisisPlatform/.bundle/gems/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/tools/gyp/libv8_base.a'to exist, but it was not found (Libv8::Location::Vendor::ArchiveNotFound) 
    from /Users/Adam/Dropbox/AisisGit/AisisPlatform/.bundle/gems/gems/libv8-3.16.14.3/ext/libv8/location.rb:35:in `each' 
    from /Users/Adam/Dropbox/AisisGit/AisisPlatform/.bundle/gems/gems/libv8-3.16.14.3/ext/libv8/location.rb:35:in `verify_installation!' 
    from /Users/Adam/Dropbox/AisisGit/AisisPlatform/.bundle/gems/gems/libv8-3.16.14.3/ext/libv8/location.rb:26:in `install!' 
    from extconf.rb:7:in `<main>' 
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 
    CXX(target) /Users/Adam/Dropbox/AisisGit/AisisPlatform/.bundle/gems/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/allocation.o 
    CXX(target) /Users/Adam/Dropbox/AisisGit/AisisPlatform/.bundle/gems/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/atomicops_internals_x86_gcc.o 
    CXX(target) /Users/Adam/Dropbox/AisisGit/AisisPlatform/.bundle/gems/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum.o 
    CXX(target) /Users/Adam/Dropbox/AisisGit/AisisPlatform/.bundle/gems/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum-dtoa.o 
    CXX(target) /Users/Adam/Dropbox/AisisGit/AisisPlatform/.bundle/gems/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/cached-powers.o 

extconf failed, exit code 1 

Gem files will remain installed in /Users/Adam/Dropbox/AisisGit/AisisPlatform/.bundle/gems/gems/libv8-3.16.14.3 for inspection. 
Results logged to /Users/Adam/Dropbox/AisisGit/AisisPlatform/.bundle/gems/extensions/x86_64-darwin-14/2.1.0/libv8-3.16.14.3/gem_make.out 
An error occurred while installing libv8 (3.16.14.3), and Bundler cannot continue. 
Make sure that `gem install libv8 -v '3.16.14.3'` succeeds before bundling. 

這是怎麼回事。

注意:我正在Mac上做所有這些。

回答

24

我得到這個先用自制安裝V8工作:

$ brew install v8 

然後運行你在谷歌找到你所提到的命令:

$ gem install libv8 -v '3.16.14.3' -- --with-system-v8 

最後再運行捆綁安裝:

$ bundle install 
+3

這沒有奏效,我得到了與上面完全相同的錯誤。 – SeekingTruth 2014-12-05 17:26:54

+0

爲我工作,謝謝! – SupaIrish 2015-02-26 04:50:14

+0

它的工作原理!謝謝! – 2015-03-11 12:27:21

0

正如其他人建議:

$ brew install v8 
$ gem install libv8 -v '3.16.14.3' -- --with-system-v8 
$ bundle install 

如果這樣不起作用,請嘗試運行bundle update

運行除了bundle update只是它的工作

2

此錯誤是與therubyracer項目和其他的答案並沒有解決這個問題,我常用的方式。他們雖然幫助。安裝順序似乎是線索。

$ gem uninstall libv8 
Successfully uninstalled libv8-3.16.14.13 
$ gem install therubyracer -v '0.12.2' 
2 gems installed 
$ bundle 
CRASH 
$ gem install libv8 -v '3.16.14.13' -- --with-system-v8 
Successfully installed libv8-3.16.14.13 
1 gem installed 
$ bundle 
SUKSESS 

去圖,這是不好的。但它爲我解決了它。

+0

這是唯一的工作..謝謝 – 2017-09-02 03:34:29