linux中无法安装sassc包的解决办法

今天在安装一个项目的依赖时,遇到无法安装sassc这个包,经过几个小时的努力,找到了解决法

本人使用的环境是 Ubuntu 20.04.4 LTS (GNU/Linux 5.4.0-117-generic x86_64)

安装依赖包的命令是:
在项目目录下执行

bundle install

其它包都能正常安装,当遇到sassc这个包时报错了

bundle install
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine.
Fetching gem metadata from https://rubygems.org/............
Using concurrent-ruby 1.1.9
Using i18n 1.6.0
Using minitest 5.14.4
Using tzinfo 2.0.4
Using zeitwerk 2.5.1
Using activesupport 6.1.4.1
Using public_suffix 4.0.6
Using addressable 2.8.0
Using execjs 2.7.0
Using autoprefixer-rails 10.2.5.0
Using backports 3.21.0
Using bundler 2.3.17
Using coffee-script-source 1.12.2
Using coffee-script 2.4.1
Using contracts 0.13.0
Using dotenv 2.7.6
Using erubis 2.7.0
Using fast_blank 1.0.1
Using fastimage 2.2.5
Using ffi 1.15.4
Using temple 0.8.2
Using tilt 2.0.10
Using haml 5.2.2
Using hamster 3.0.0
Using hashie 3.6.0
Using rexml 3.2.5
Using kramdown 2.3.1
Using rb-fsevent 0.11.0
Using rb-inotify 0.10.1
Using listen 3.0.8
Using memoist 0.16.2
Using thor 1.1.0
Using middleman-cli 4.4.2
Using padrino-support 0.15.1
Using padrino-helpers 0.15.1
Using parallel 1.21.0
Using rack 2.2.3
Installing sassc 2.4.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

然后单独安装这个包

gem install sassc

也会报错,然后各种百度,百度上的关于sassc安装的资料比较少,然后到国外网站上,终于看到了一种解决办法:

gem install sassc -- --disable-march-tune-native

用这个命令安装依赖包就可以了

我试了一下,就正常了

bundle install
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine.
Fetching gem metadata from https://rubygems.org/............
Using concurrent-ruby 1.1.9
Using i18n 1.6.0
Using minitest 5.14.4
Using tzinfo 2.0.4
Using zeitwerk 2.5.1
Using activesupport 6.1.4.1
Using public_suffix 4.0.6
Using addressable 2.8.0
Using execjs 2.7.0
Using autoprefixer-rails 10.2.5.0
Using backports 3.21.0
Using bundler 2.3.17
Using coffee-script-source 1.12.2
Using coffee-script 2.4.1
Using contracts 0.13.0
Using dotenv 2.7.6
Using erubis 2.7.0
Using fast_blank 1.0.1
Using fastimage 2.2.5
Using ffi 1.15.4
Using temple 0.8.2
Using tilt 2.0.10
Using haml 5.2.2
Using hamster 3.0.0
Using hashie 3.6.0
Using rexml 3.2.5
Using kramdown 2.3.1
Using rb-fsevent 0.11.0
Using rb-inotify 0.10.1
Using listen 3.0.8
Using memoist 0.16.2
Using thor 1.1.0
Using middleman-cli 4.4.2
Using padrino-support 0.15.1
Using padrino-helpers 0.15.1
Using parallel 1.21.0
Using rack 2.2.3
Using sassc 2.4.0
Fetching servolux 0.13.0
Installing servolux 0.13.0
Fetching parslet 2.0.0
Installing parslet 2.0.0
Fetching toml 0.3.0
Installing toml 0.3.0
Fetching uglifier 3.2.0
Installing uglifier 3.2.0
Fetching webrick 1.7.0
Installing webrick 1.7.0
Fetching middleman-core 4.4.2
Installing middleman-core 4.4.2
Fetching middleman 4.4.2
Installing middleman 4.4.2
Fetching middleman-autoprefixer 3.0.0
Installing middleman-autoprefixer 3.0.0
Fetching sprockets 3.7.2
Installing sprockets 3.7.2
Fetching middleman-sprockets 4.1.1
Installing middleman-sprockets 4.1.1
Fetching rouge 3.28.0
Installing rouge 3.28.0
Fetching middleman-syntax 3.2.0
Installing middleman-syntax 3.2.0
Fetching mini_portile2 2.8.0
Installing mini_portile2 2.8.0
Fetching racc 1.6.0
Installing racc 1.6.0 with native extensions
Fetching nokogiri 1.13.4 (x86_64-linux)
Installing nokogiri 1.13.4 (x86_64-linux)
Fetching redcarpet 3.5.1
Installing redcarpet 3.5.1 with native extensions
Using sass-listen 4.0.0
Using sass 3.7.4
Bundle complete! 9 Gemfile dependencies, 56 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.

如果有遇到在linux环境中安装sassc无法安装的也可以用此方法试试

此方法的原文在

//stackoverflow.com/questions/66456656/error-installing-sassc-clang-compiler-does-not-support-march-native-m1
//github.com/sass/sassc-ruby/issues/222#issuecomment-857092485
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

北漂燕郊杨哥

您的支持是我最大的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值