gem Mac OS Sierra 10.12.6 更新后安装指南针错误
gem install compass error after Mac OS Sierra 10.12.6 update
几天前我做了一个 Mac OS Sierra 10.12.6 安全更新 2018-005。昨天我 运行 grunt 得到一个:
Warning: Running "sass:dist" (sass) task
Warning: spawn sass ENOENT Use --force to continue.
Aborted due to warnings.
我按照此处的说明操作:https://github.com/appseed-io/supermodular/issues/45
xcode-select --install
sudo gem update --system
sudo gem install -n /usr/local/bin compass
我仍然遇到咕噜咕噜的错误:
Running "sass:build" (sass) task
ERROR: Cannot load compass.
Warning: Exited with error code 1 Use --force to continue.
Aborted due to warnings.
然后我按照这里的说明操作:https://halfelf.org/2017/grunt-cant-build-sass-on-high-sierra/
brew install rbenv ruby-build
rbenv install 2.4.2
rbenv global 2.4.2
sudo gem update --system
sudo gem install -n /usr/local/bin sass
还在抱怨ERROR: Cannot load compass.
然后再次尝试 sudo gem install -n /usr/local/bin compass
,但出现以下错误:
ERROR: Error installing compass:
ERROR: Failed to build gem native extension.
我检查了 mkmf.log 文件,上面写着:
"pkg-config --exists libffi"
package configuration for libffi is not found
"xcrun clang -o conftest -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin16 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby/backward -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/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 -iwithsysroot /usr/local/libressl/include conftest.c -L. -L/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib -L. -L /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.Internal.sdk/usr/local/libressl/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.Internal.sdk/usr/local/lib -arch x86_64 -arch i386 -lruby.2.3.0 -lpthread -ldl -lobjc "
In file included from conftest.c:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby.h:33:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/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 */
我从中得到的(不是真的知道)是 package configuration for libffi is not found
和 fatal error: 'ruby/config.h' file not found
。
附加信息:
Xcode 版本 9.2 (9C40b)
ruby -v
ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin16]
sass -v
Sass 3.4.25 (Selective Steve)
compass -v
-bash: /usr/local/bin/compass:
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby: bad interpreter: No such file or directory
提前致谢。
更新
我运行gem env
。这是输出:
RubyGems Environment:
- RUBYGEMS VERSION: 2.7.8
- RUBY VERSION: 2.3.7 (2018-03-28 patchlevel 456) [universal.x86_64-darwin16]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.3.0
- USER INSTALLATION DIRECTORY: /Users/username/.gem/ruby/2.3.0
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/bin
- SPEC CACHE DIRECTORY: /Users/username/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Library/Ruby/Site
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-16
- GEM PATHS:
- /Library/Ruby/Gems/2.3.0
- /Users/username/.gem/ruby/2.3.0
- /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/gems/2.3.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/username/.nvm/versions/node/v8.4.0/bin
- /Users/username/.wp-cli/bin
- /usr/local/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
不要sudo gem install -n /usr/local/bin compass
使用 rbenv
的全部意义在于让它处理您的所有依赖项,而不必处理您的 OS 系统 ruby 或它的 gem。你需要让你的 $PATH
配置正确然后你就不需要使用 sudo
事实上你不应该在获得你的环境后使用 gem install
或任何 gem
命令正确设置。
你试过了吗npm install -g grunt-cli
?
更新:如预期的那样,您的 $PATH 不正确。
关闭所有终端。开始一个新的。然后运行这个。
curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | bash
这应该可以帮助您找出 $PATH
设置中的错误。
参考https://github.com/rbenv/rbenv#installation
但首先具体尝试:
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
然后重新启动您的终端并再次检查 gem env
并查看您的路径是否包含 .rbenv
如果这些步骤不能让您正常工作,那么我建议完全卸载 rbenv 并从 https://github.com/rbenv/rbenv#installation
的第 1 步重新开始
几天前我做了一个 Mac OS Sierra 10.12.6 安全更新 2018-005。昨天我 运行 grunt 得到一个:
Warning: Running "sass:dist" (sass) task
Warning: spawn sass ENOENT Use --force to continue.
Aborted due to warnings.
我按照此处的说明操作:https://github.com/appseed-io/supermodular/issues/45
xcode-select --install
sudo gem update --system
sudo gem install -n /usr/local/bin compass
我仍然遇到咕噜咕噜的错误:
Running "sass:build" (sass) task
ERROR: Cannot load compass.
Warning: Exited with error code 1 Use --force to continue.
Aborted due to warnings.
然后我按照这里的说明操作:https://halfelf.org/2017/grunt-cant-build-sass-on-high-sierra/
brew install rbenv ruby-build
rbenv install 2.4.2
rbenv global 2.4.2
sudo gem update --system
sudo gem install -n /usr/local/bin sass
还在抱怨ERROR: Cannot load compass.
然后再次尝试 sudo gem install -n /usr/local/bin compass
,但出现以下错误:
ERROR: Error installing compass:
ERROR: Failed to build gem native extension.
我检查了 mkmf.log 文件,上面写着:
"pkg-config --exists libffi"
package configuration for libffi is not found
"xcrun clang -o conftest -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin16 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby/backward -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/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 -iwithsysroot /usr/local/libressl/include conftest.c -L. -L/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib -L. -L /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.Internal.sdk/usr/local/libressl/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.Internal.sdk/usr/local/lib -arch x86_64 -arch i386 -lruby.2.3.0 -lpthread -ldl -lobjc "
In file included from conftest.c:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby.h:33:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/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 */
我从中得到的(不是真的知道)是 package configuration for libffi is not found
和 fatal error: 'ruby/config.h' file not found
。
附加信息:
Xcode 版本 9.2 (9C40b)
ruby -v
ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin16]
sass -v
Sass 3.4.25 (Selective Steve)
compass -v
-bash: /usr/local/bin/compass:
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby: bad interpreter: No such file or directory
提前致谢。
更新
我运行gem env
。这是输出:
RubyGems Environment:
- RUBYGEMS VERSION: 2.7.8
- RUBY VERSION: 2.3.7 (2018-03-28 patchlevel 456) [universal.x86_64-darwin16]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.3.0
- USER INSTALLATION DIRECTORY: /Users/username/.gem/ruby/2.3.0
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/bin
- SPEC CACHE DIRECTORY: /Users/username/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Library/Ruby/Site
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-16
- GEM PATHS:
- /Library/Ruby/Gems/2.3.0
- /Users/username/.gem/ruby/2.3.0
- /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/gems/2.3.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/username/.nvm/versions/node/v8.4.0/bin
- /Users/username/.wp-cli/bin
- /usr/local/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
不要sudo gem install -n /usr/local/bin compass
使用 rbenv
的全部意义在于让它处理您的所有依赖项,而不必处理您的 OS 系统 ruby 或它的 gem。你需要让你的 $PATH
配置正确然后你就不需要使用 sudo
事实上你不应该在获得你的环境后使用 gem install
或任何 gem
命令正确设置。
你试过了吗npm install -g grunt-cli
?
更新:如预期的那样,您的 $PATH 不正确。
关闭所有终端。开始一个新的。然后运行这个。
curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | bash
这应该可以帮助您找出 $PATH
设置中的错误。
参考https://github.com/rbenv/rbenv#installation
但首先具体尝试:
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
然后重新启动您的终端并再次检查 gem env
并查看您的路径是否包含 .rbenv
如果这些步骤不能让您正常工作,那么我建议完全卸载 rbenv 并从 https://github.com/rbenv/rbenv#installation
的第 1 步重新开始