Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 错误:安装sass时出错:错误:无法生成gem本机扩展_Ruby_Sass_Rubygems_Package - Fatal编程技术网

Ruby 错误:安装sass时出错:错误:无法生成gem本机扩展

Ruby 错误:安装sass时出错:错误:无法生成gem本机扩展,ruby,sass,rubygems,package,Ruby,Sass,Rubygems,Package,我正试图安装sass。我确实通过npm(1.14.1用dart2js 2.0.0编译)安装了它,但是我需要用Ruby(Ruby Sass 3.5.6.)安装它。现在,我运行“sudogem安装sass”时出现了一个错误 有什么想法吗?好的,所以找到了解决方案。如果你有这个错误。这样做: 安装rvm() 然后我必须运行此命令以使rvm正常工作: 如果sudo grep-q secure_path/etc/sudoers;然后sudo sh-c“echo export rvmsudo_secur

我正试图安装sass。我确实通过npm(1.14.1用dart2js 2.0.0编译)安装了它,但是我需要用Ruby(Ruby Sass 3.5.6.)安装它。现在,我运行“sudogem安装sass”时出现了一个错误


有什么想法吗?

好的,所以找到了解决方案。如果你有这个错误。这样做:

  • 安装rvm()

  • 然后我必须运行此命令以使rvm正常工作:

  • 如果sudo grep-q secure_path/etc/sudoers;然后sudo sh-c“echo export rvmsudo_secure_path=1>>/etc/profile.d/rvm_secure_path.sh”&安装了echo环境变量;fi

  • 接下来,使用rvm,我删除了ruby:
  • 移除红宝石

  • 最后安装ruby:
  • rvm安装ruby

  • 不确定是否需要此步骤,但这是我在控制台中使用的:Ruby是在没有文档的情况下构建的,要构建它,请运行:rvm docs generate ri

    所以我也运行了这个命令。在那之后,我终于能够安装sudo gem sass了


  • 现在它工作了

    在mac中执行以下步骤以安装无错误的SASS

  • 安装gpg brew安装-v gpg
  • 安装gpg密钥 gpg2——接收键409B6B1796C275462A1703113804B82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
  • 允许curl在不检查SSL的情况下运行(否则命令#4将抛出错误) 回声不安全>>~/.curlrc
  • 安装rvm \curl-sSL-k | bash
  • 要使用rvm,在#3中运行命令后将得到一个输出,如: 要开始使用RVM,您需要运行
    source/Users/ymeta/.RVM/scripts/RVM
    复制粘贴命令并按Enter键
  • 删除现有的ruby版本 移除红宝石
  • 安装ruby rvm安装ruby
  • rvm文档生成ri
  • 安装sass sudogems安装sass
  • 检查sass版本 sass——版本

  • 中可以找到相同的步骤,基本上只需删除ruby并重新安装即可。它为我解决了这个问题。我安装了rvm,然后简单地运行
    rvm安装ruby
    。我不需要做任何其他事情,因为安装似乎是在我的mac本机ruby上安装的。
    Building native extensions. This could take a while...
    ERROR:  Error installing sass:
    ERROR: Failed to build gem native extension.
    
    current directory: /Library/Ruby/Gems/2.3.0/gems/ffi-1.9.25/ext/ffi_c
    /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20181004-3909-1iytz3s.rb extconf.rb
    checking for ffi.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.3/usr/bin/$(RUBY_BASE_NAME)
    --with-ffi_c-dir
    --without-ffi_c-dir
    --with-ffi_c-include
    --without-ffi_c-include=${ffi_c-dir}/include
    --with-ffi_c-lib
    --without-ffi_c-lib=${ffi_c-dir}/lib
    --with-libffi-config
    --without-libffi-config
    --with-pkg-config
    --without-pkg-config 
    
    /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/
    2.3.0/mkmf.rb:456: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.3/usr/lib/ruby/
    2.3.0/mkmf.rb:571:in `block in try_compile'
    from 
    /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/
    2.3.0/mkmf.rb:524:in `with_werror'
    from 
    /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/
    2.3.0/mkmf.rb:571:in `try_compile'
    from 
    /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/
    2.3.0/mkmf.rb:1091:in `block in have_header'
    from 
    /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/
    2.3.0/mkmf.rb:942:in `block in checking_for'
    from 
    /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/
    2.3.0/mkmf.rb:350:in `block (2 levels) in postpone'
    from 
    /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/
    2.3.0/mkmf.rb:320:in `open'
    from 
    /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/
    2.3.0/mkmf.rb:350:in `block in postpone'
    from 
    /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/
    2.3.0/mkmf.rb:320:in `open'
    from 
    /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/
    2.3.0/mkmf.rb:346:in `postpone'
    from 
    /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/
    2.3.0/mkmf.rb:941:in `checking_for'
    from 
    /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/
    2.3.0/mkmf.rb:1090:in `have_header'
    from extconf.rb:16:in `<main>'
    
    To see why this extension failed to compile, please check the mkmf.log which can be found here:
    
     /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-18/2.3.0/ffi-1.9.25/mkmf.log
    
    extconf failed, exit code 1
    
    Gem files will remain installed in /Library/Ruby/Gems/2.3.0/gems/ffi-1.9.25 for inspection.
    Results logged to /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-18/2.3.0/ffi-1.9.25/gem_make.out
    
    package configuration for libffi is not found
    "xcrun clang -o conftest - 
    I/System/Library/Frameworks/Ruby.framework
    /Versions/2.3/usr/include/ruby-2.3.0/universal-darwin18 - 
    I/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/
    include/ruby-2.3.0/ruby/backward - 
    I/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/
    ruby-2.3.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE - 
    D_DARWIN_UNLIMITED_SELECT -D_REENTRANT    -g -Os -pipe - 
    DHAVE_GCC_ATOMIC_BUILTINS conftest.c  -L. - 
    L/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib -L.     
    -lruby.2.3.0  -lpthread -ldl -lobjc "
    In file included from conftest.c:1:
    In file included from 
    /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/
    ruby-2.3.0/ruby.h:33:
    /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/
    ruby-2.3.0/ruby/ruby.h:24:10: fatal error: 'ruby/config.h' file not found
    #include "ruby/config.h"
         ^~~~~~~~~~~~~~~
    1 error generated.
    checked program was:
    /* begin */
    1: #include "ruby.h"
    2: 
    3: int main(int argc, char **argv)
    4: {
    5:   return 0;
    6: }
    /* end */