使用Rails的捆绑器出现问题(Mac用户) [英] Problem with bundler using rails (mac user)

查看:26
本文介绍了使用Rails的捆绑器出现问题(Mac用户)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试运行我的应用程序时,收到以下错误:

Could not find racc-1.5.2 in any of the sources
Run `bundle install` to install missing gems.

我跑步:

$ bundle install

响应:

Your user account isn't allowed to install to the system RubyGems.
  You can cancel this installation and run:

      bundle config set --local path 'vendor/bundle'
      bundle install

$键入密码两次(系统询问两次)

响应:

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

    current directory: /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-861puoracc-1.5.2/gems/racc-1.5.2/ext/racc/cparse
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /Library/Ruby/Site/2.6.0 -r ./siteconf20210303-5388-1sxj4i7.rb extconf.rb
checking for rb_ary_subseq()... *** 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)
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file.
(RuntimeError)
You have to install development tools first.
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:546:in `block in try_link0'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/tmpdir.rb:93:in `mktmpdir'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:543:in `try_link0'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:570:in `try_link'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:782:in `try_func'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1069:in `block in have_func'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:959:in `block in checking_for'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in `block (2 levels) in postpone'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in `open'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in `block in postpone'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in `open'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:357:in `postpone'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:958:in `checking_for'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1068:in `have_func'
    from extconf.rb:6:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-861puoracc-1.5.2/extensions/universal-darwin-20/2.6.0/racc-1.5.2/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-861puoracc-1.5.2/gems/racc-1.5.2 for inspection.
Results logged to
/var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-861puoracc-1.5.2/extensions/universal-darwin-20/2.6.0/racc-1.5.2/gem_make.out

An error occurred while installing racc (1.5.2), and Bundler cannot continue.
Make sure that `gem install racc -v '1.5.2' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  rails was resolved to 6.1.3, which depends on
    actioncable was resolved to 6.1.3, which depends on
      actionpack was resolved to 6.1.3, which depends on
        actionview was resolved to 6.1.3, which depends on
          rails-dom-testing was resolved to 2.0.3, which depends on
            nokogiri was resolved to 1.11.1, which depends on
              racc


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

    current directory: /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-5s57nvnio4r-2.5.5/gems/nio4r-2.5.5/ext/nio4r
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /Library/Ruby/Site/2.6.0 -r ./siteconf20210303-5388-1yywys0.rb extconf.rb
checking for unistd.h... *** 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)
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file.
(RuntimeError)
You have to install development tools first.
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:585:in `block in try_compile'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:534:in `with_werror'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:585:in `try_compile'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1109:in `block in have_header'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:959:in `block in checking_for'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in `block (2 levels) in postpone'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in `open'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in `block in postpone'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in `open'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:357:in `postpone'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:958:in `checking_for'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1108:in `have_header'
    from extconf.rb:15:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-5s57nvnio4r-2.5.5/extensions/universal-darwin-20/2.6.0/nio4r-2.5.5/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-5s57nvnio4r-2.5.5/gems/nio4r-2.5.5 for
inspection.
Results logged to
/var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-5s57nvnio4r-2.5.5/extensions/universal-darwin-20/2.6.0/nio4r-2.5.5/gem_make.out

An error occurred while installing nio4r (2.5.5), and Bundler cannot continue.
Make sure that `gem install nio4r -v '2.5.5' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  rails was resolved to 6.1.3, which depends on
    actioncable was resolved to 6.1.3, which depends on
      nio4r


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

    current directory: /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-4k1ekzbcrypt-3.1.16/gems/bcrypt-3.1.16/ext/mri
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /Library/Ruby/Site/2.6.0 -r ./siteconf20210303-5388-1xu8ddx.rb extconf.rb
creating Makefile

current directory: /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-4k1ekzbcrypt-3.1.16/gems/bcrypt-3.1.16/ext/mri
make DESTDIR= clean

current directory: /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-4k1ekzbcrypt-3.1.16/gems/bcrypt-3.1.16/ext/mri
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-darwin20/ruby/config.h',
needed by `bcrypt_ext.o'.  Stop.

make failed, exit code 2

Gem files will remain installed in /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-4k1ekzbcrypt-3.1.16/gems/bcrypt-3.1.16 for
inspection.
Results logged to
/var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-4k1ekzbcrypt-3.1.16/extensions/universal-darwin-20/2.6.0/bcrypt-3.1.16/gem_make.out

An error occurred while installing bcrypt (3.1.16), and Bundler cannot continue.
Make sure that `gem install bcrypt -v '3.1.16' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  devise was resolved to 4.7.3, which depends on
    bcrypt


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

    current directory: /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-z8an9bbindex-0.8.1/gems/bindex-0.8.1/ext/skiptrace
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /Library/Ruby/Site/2.6.0 -r ./siteconf20210303-5388-1k62vcs.rb extconf.rb
creating Makefile

current directory: /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-z8an9bbindex-0.8.1/gems/bindex-0.8.1/ext/skiptrace
make DESTDIR= clean

current directory: /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-z8an9bbindex-0.8.1/gems/bindex-0.8.1/ext/skiptrace
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-darwin20/ruby/config.h',
needed by `cruby.o'.  Stop.

make failed, exit code 2

Gem files will remain installed in /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-z8an9bbindex-0.8.1/gems/bindex-0.8.1 for
inspection.
Results logged to
/var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-z8an9bbindex-0.8.1/extensions/universal-darwin-20/2.6.0/bindex-0.8.1/gem_make.out

An error occurred while installing bindex (0.8.1), and Bundler cannot continue.
Make sure that `gem install bindex -v '0.8.1' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  web-console was resolved to 4.1.0, which depends on
    bindex


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

    current directory: /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-tk45tbmsgpack-1.4.2/gems/msgpack-1.4.2/ext/msgpack
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /Library/Ruby/Site/2.6.0 -r ./siteconf20210303-5388-5tsgu7.rb extconf.rb
checking for ruby/st.h... *** 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)
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file.
(RuntimeError)
You have to install development tools first.
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:585:in `block in try_compile'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:534:in `with_werror'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:585:in `try_compile'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1109:in `block in have_header'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:959:in `block in checking_for'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in `block (2 levels) in postpone'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in `open'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in `block in postpone'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in `open'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:357:in `postpone'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:958:in `checking_for'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1108:in `have_header'
    from extconf.rb:3:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-tk45tbmsgpack-1.4.2/extensions/universal-darwin-20/2.6.0/msgpack-1.4.2/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-tk45tbmsgpack-1.4.2/gems/msgpack-1.4.2 for
inspection.
Results logged to
/var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-tk45tbmsgpack-1.4.2/extensions/universal-darwin-20/2.6.0/msgpack-1.4.2/gem_make.out

An error occurred while installing msgpack (1.4.2), and Bundler cannot continue.
Make sure that `gem install msgpack -v '1.4.2' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  bootsnap was resolved to 1.7.2, which depends on
    msgpack


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

    current directory: /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-pjciubbyebug-11.1.3/gems/byebug-11.1.3/ext/byebug
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /Library/Ruby/Site/2.6.0 -r ./siteconf20210303-5388-18f31t0.rb extconf.rb
creating Makefile

current directory: /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-pjciubbyebug-11.1.3/gems/byebug-11.1.3/ext/byebug
make DESTDIR= clean

current directory: /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-pjciubbyebug-11.1.3/gems/byebug-11.1.3/ext/byebug
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-darwin20/ruby/config.h',
needed by `breakpoint.o'.  Stop.

make failed, exit code 2

Gem files will remain installed in /var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-pjciubbyebug-11.1.3/gems/byebug-11.1.3 for
inspection.
Results logged to
/var/folders/_b/7g9qk9qn2tbc7m16nsnj7jww0000gn/T/bundler20210303-5388-pjciubbyebug-11.1.3/extensions/universal-darwin-20/2.6.0/byebug-11.1.3/gem_make.out

An error occurred while installing byebug (11.1.3), and Bundler cannot continue.
Make sure that `gem install byebug -v '11.1.3' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  byebug

信息:

ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20]

Bundler版本2.2.12(2021-03-01 Commit 1de3f8de73)(这是我开始遇到问题的时候)

rails -v
Rails 6.1.3

推荐答案

我自己也遇到过这个问题。您只需更新适用于Mac的CommandLineTools。

在我的根目录中运行此代码已修复:

Xcode-选择--安装

这篇关于使用Rails的捆绑器出现问题(Mac用户)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆