如何修复Ruby Compass的NoMethodError问题(1.0.0和1.0.3)

z6psavjg  于 2023-06-05  发布在  Ruby
关注(0)|答案(1)|浏览(214)

我有一个Fedora 38(6.1.29-1)服务器,安装了Ruby和Compass gem。
当我尝试执行compass -h或执行任何compass编译时,我得到一个NoMethodError(在不同.rb文件的不同行上,但仍然是错误)。
我到处寻找类似的错误,似乎找不到其他人遇到这个问题。
一开始我以为Compass的最新版本(1.0.3)在我的服务器上不起作用,所以我也尝试了1.0.0,但仍然得到同样的错误。
我还尝试安装相同的版本(s),并遵循相同的过程在我的Windows机器上,并没有问题时,执行相同的compass -h和compass编译命令。
有谁知道是什么导致了我的fedora服务器上的这个错误?
当在Fedora服务器上的命令行上执行“compass -h”时...
电流输出:

NoMethodError on line ["144"] of /home/user1/.local/share/gem/ruby/gems/compass-1.0.0/lib/compass/installers/manifest.rb: undefined method `exists?' for File:Class

预期输出:

Usage: compass help [command]

Description:
  The Compass Stylesheet Authoring Framework helps you
  build and maintain your stylesheets and makes it easy
  for you to use stylesheet libraries provided by others.

Donating:
  Compass is charityware. If you find it useful please make
  a tax deductable donation: http://umdf.org/compass

To get help on a particular command please specify the command.

Primary Commands:
  * clean       - Remove generated files and the sass cache
  * compile     - Compile Sass stylesheets to CSS
  * create      - Create a new compass project
  * init        - Add compass to an existing project
  * watch       - Compile Sass stylesheets to CSS when they change
Other Commands:
  * config      - Generate a configuration file for the provided command line options.
  * extension   - Manage the list of compass extensions on your system
  * frameworks  - List the available frameworks
  * help        - Get help on a compass command or extension
  * imports     - Emit an imports suitable for passing to the sass command-line.
  * install     - Install an extension's pattern into your compass project
  * interactive - Interactively evaluate SassScript
  * sprite      - Generate an import for your sprites.
  * stats       - Report statistics about your stylesheets
  * unpack      - Copy an extension into your extensions folder.
  * validate    - Validate your generated css.
  * version     - Print out version information

Available Frameworks & Patterns:

  * compass
    - compass/ellipsis  - Plugin for cross-browser ellipsis truncated text.
    - compass/extension - Generate a compass extension.
    - compass/project   - The default project layout.

Global Options:
    -r, --require LIBRARY            Require the given ruby LIBRARY before running commands.
                                       This is used to access compass plugins without having a
                                       project configuration file.
    -l, --load FRAMEWORK_DIR         Load the framework or extensions found in the FRAMEWORK directory.
    -L, --load-all FRAMEWORKS_DIR    Load all the frameworks or extensions found in the FRAMEWORKS_DIR directory.
    -I, --import-path IMPORT_PATH    Makes files under the IMPORT_PATH folder findable by Sass's @import directive.
    -q, --quiet                      Quiet mode.
        --trace                      Show a full stacktrace on error
        --force                      Allows compass to overwrite existing files.
        --boring                     Turn off colorized output.
    -?, -h, --help                   Show this message
xpcnnkqh

xpcnnkqh1#

File.exists?在几个次要版本中被弃用,直到Ruby 2.7才出现。最后在Ruby 3.0中被删除。
compass gem的最新版本已经超过8年了。这意味着它不再适用于当前版本的Ruby。
你基本上有三个选择:
1.将您的Ruby版本降级到例如2.7.8。这个版本并不可怕,但请记住,Ruby 2.7已经到了生命周期的尽头,它将不再获得任何安全性或错误修复。

  1. Fork compass gem并修复File.exists?File.exist?的用法。这似乎是一个快速修复,但鉴于此gem在过去8年中没有得到任何更新,您可能会发现进一步的兼容性问题或未修复的错误。
    1.寻找一个替代品,并取代宝石。

相关问题