mac上在使用sass编译时遇到下列报错。
![](https://img.haomeiwen.com/i1124837/b3967eaa2f75bcc3.png)
找不到ffi,那就尝试安装一下,但是也遇到了问题。
错误信息:Failed to build gem native extension
![](https://img.haomeiwen.com/i1124837/2d020f8735f9aa2e.png)
这种一般来说可能是Command Line Tools没有安装好,记得之前是需要完整安装Xcode,但是我并不需要这个开发工具,这就很尴尬。找了一通发现现在已经不需要先安装Xcode才能安装Command Line Tools。
MacOS上一些第三方工具可能需要有Command Line Tools才能运行。
MacOS 10.10+后无需像之前一样必须先安装Xcode才能安装Command Line Tools,打开终端,输入xcode-select --install即可。
安装完毕后 再次打开终端输入xcode-select --install提示command line tools are already installed则表示安装成功。
- 安装command line tools。
xcode-select --install
弹出安装程序后直接安装即可。
- 再次输入命令验证是否安装完成
xcode-select --install
![](https://img.haomeiwen.com/i1124837/2698e6edb1877403.png)
-
全局安装ffi,中间可能需要几十秒,成功!
-
重新试一把sass,报错
错误信息exception while processing events: incompatible character encodings: ASCII-8BIT and UTF-8 Backtrace
错误原因:watch编译的路径不能有中文。
-
换个路径重试sass,成功!
网友评论