![在 Rails 服务器部署期间,捆绑包安装在 sasc 上冻结](https://linux22.com/image/755227/%E5%9C%A8%20Rails%20%E6%9C%8D%E5%8A%A1%E5%99%A8%E9%83%A8%E7%BD%B2%E6%9C%9F%E9%97%B4%EF%BC%8C%E6%8D%86%E7%BB%91%E5%8C%85%E5%AE%89%E8%A3%85%E5%9C%A8%20sasc%20%E4%B8%8A%E5%86%BB%E7%BB%93.png)
我正在尝试使用 capistrano 部署 Rails 应用程序。由 启动的部署脚本cap production deploy
运行良好,直到出现以下命令:
$HOME/.rbenv/bin/rbenv exec bundle install --path /home/deploy/app/shared/bundle --jobs 4 --without development test --deployment --debug --backtrace --quiet
我通过 ssh 进入服务器并运行相同的命令,但将标志替换--quiet
为--verbose
,然后看到捆绑包在 sassc 安装上被冻结:
Using activestorage 6.0.3.2
Using actionmailbox 6.0.3.2
Using webpacker 4.2.2
Using actiontext 6.0.3.2
Using rails 6.0.3.2
Installing sassc 2.4.0 with native extensions
通过广泛的研究,我了解到使用本机扩展进行安装可能需要很长时间,但无论我让它运行多长时间,都不会发生任何事情。我让它运行了一整夜后,以详细模式手动安装了该 gem,它似乎成功了:
compiling ./libsass/src/position.cpp
compiling ./libsass/src/prelexer.cpp
compiling ./libsass/src/remove_placeholders.cpp
compiling ./libsass/src/sass.cpp
compiling ./libsass/src/sass2scss.cpp
compiling ./libsass/src/sass_context.cpp
compiling ./libsass/src/sass_functions.cpp
compiling ./libsass/src/sass_values.cpp
compiling ./libsass/src/source.cpp
compiling ./libsass/src/source_map.cpp
compiling ./libsass/src/stylesheet.cpp
compiling ./libsass/src/to_value.cpp
compiling ./libsass/src/units.cpp
compiling ./libsass/src/utf8_string.cpp
compiling ./libsass/src/util.cpp
compiling ./libsass/src/util_string.cpp
compiling ./libsass/src/values.cpp
linking shared-object sassc/libsass.so
current directory: /home/deploy/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/sassc-2.4.0/ext
"make \"DESTDIR=\" install"
/usr/bin/install -c -m 0755 libsass.so ./.gem.20200720-1092-b4v9ch/sassc
current directory: /home/deploy/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/sassc-2.4.0/ext
/home/deploy/.rbenv/versions/2.6.3/bin/ruby -I /home/deploy/.rbenv/versions/2.6.3/lib/ruby/2.6.0 -r ./siteconf20200720-1092-1xt3w4b.rb extconf.rb
current directory: /home/deploy/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/sassc-2.4.0/ext
make "DESTDIR=" clean
current directory: /home/deploy/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/sassc-2.4.0/ext
make "DESTDIR="
current directory: /home/deploy/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/sassc-2.4.0/ext
make "DESTDIR=" install
Successfully installed sassc-2.4.0
Parsing documentation for sassc-2.4.0
Parsing sources...
100% [261/261] lib/sassc/version.rb
Done installing documentation for sassc after 1 seconds
1 gem installed
但部署仍然冻结sassc
。
我正在 AWS EC2 实例上进行部署,并注意到在部署脚本运行几个小时后,我的所有 CPU 积分都已耗尽,因此我甚至打开了无限制模式,通过支付额外的 CPU 周期来解决这个问题。然而,我让脚本运行了几天却无济于事。我真的不知所措,这非常令人沮丧。
任何帮助将不胜感激。
答案1
https://github.com/sass/sassc-ruby/issues/189似乎是罪魁祸首。降级到较早的版本可能会修复此问题(建议使用 2.1.0)。