ruby 为什么“指南针手表”说它无法加载 sass/script/node (LoadError)?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16877028/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-06 06:01:07  来源:igfitidea点击:

Why does "compass watch" say it cannot load sass/script/node (LoadError)?

rubyrubygemscompass-sass

提问by Sam Purcell

I'm having a problem with my compass watch command - it worked fine up until a few days ago. I have made no changes to my config files.

我的指南针手表命令有问题 - 直到几天前它运行良好。我没有对我的配置文件进行任何更改。

I reinstalled Compass, used rvm to update Ruby. I checked my custom_require.rb file but I really don't know what to look for. It seems to be trying to load the file "sass/script/node" somewhere and from http://sass-lang.com/docs/yardoc/Sass/Script/Node.htmlI gather the filepath - but I have nothing there.

我重新安装了指南针,使用 rvm 更新了 Ruby。我检查了我的 custom_require.rb 文件,但我真的不知道该找什么。它似乎试图在某处加载文件“sass/script/node”,并从http://sass-lang.com/docs/yardoc/Sass/Script/Node.html我收集文件路径 - 但我那里什么都没有。

/Users/sampurcell/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `require': cannot load such file -- sass/script/node (LoadError)
  from /Users/sampurcell/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
  from /Users/sampurcell/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
  from /Users/sampurcell/.rvm/gems/ruby-1.9.3-p194/gems/compass-0.12.2/lib/compass/sass_extensions/monkey_patches/browser_support.rb:1:in `<top (required)>'
  from /Users/sampurcell/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
  from /Users/sampurcell/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
  from /Users/sampurcell/.rvm/gems/ruby-1.9.3-p194/gems/compass-0.12.2/lib/compass/sass_extensions/monkey_patches.rb:2:in `block in <top (required)>'
  from /Users/sampurcell/.rvm/gems/ruby-1.9.3-p194/gems/compass-0.12.2/lib/compass/sass_extensions/monkey_patches.rb:1:in `each'
  from /Users/sampurcell/.rvm/gems/ruby-1.9.3-p194/gems/compass-0.12.2/lib/compass/sass_extensions/monkey_patches.rb:1:in `<top (required)>'
  from /Users/sampurcell/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
  from /Users/sampurcell/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
  from /Users/sampurcell/.rvm/gems/ruby-1.9.3-p194/gems/compass-0.12.2/lib/compass/sass_extensions.rb:9:in `<top (required)>'
  from /Users/sampurcell/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
  from /Users/sampurcell/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
  from /Users/sampurcell/.rvm/gems/ruby-1.9.3-p194/gems/compass-0.12.2/lib/compass.rb:5:in `block in <top (required)>'
  from /Users/sampurcell/.rvm/gems/ruby-1.9.3-p194/gems/compass-0.12.2/lib/compass.rb:4:in `each'
  from /Users/sampurcell/.rvm/gems/ruby-1.9.3-p194/gems/compass-0.12.2/lib/compass.rb:4:in `<top (required)>'
  from /Users/sampurcell/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
  from /Users/sampurcell/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
  from /Users/sampurcell/.rvm/gems/ruby-1.9.3-p194/gems/compass-0.12.2/bin/compass:20:in `block in <top (required)>'
  from /Users/sampurcell/.rvm/gems/ruby-1.9.3-p194/gems/compass-0.12.2/bin/compass:8:in `fallback_load_path'
  from /Users/sampurcell/.rvm/gems/ruby-1.9.3-p194/gems/compass-0.12.2/bin/compass:19:in `<top (required)>'
  from /Users/sampurcell/.rvm/gems/ruby-1.9.3-p194/bin/compass:19:in `load'
  from /Users/sampurcell/.rvm/gems/ruby-1.9.3-p194/bin/compass:19:in `<main>'
  from /Users/sampurcell/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `eval'
  from /Users/sampurcell/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `<main>'

Anyone have any ideas?

谁有想法?

回答by Mike Grace

Uninstall sass and reinstall it with the following:

卸载 sass 并使用以下命令重新安装它:

gem uninstall sass
gem install sass

There was an issue with my installation of sass and doing this fixed the issue.

我安装 sass 时出现问题,这样做解决了这个问题。

回答by Nicolas Janel

In my case, Sass version was not compatible with Compass.

就我而言,Sass 版本与 Compass 不兼容。

FIX :

使固定 :

  1. uninstall Sass AND Compass

    gem uninstall compass
    gem uninstall sass
    
  2. install Compass who will install a compatible Sass engine automaticaly

    gem install compass
    
  1. 卸载 Sass 和 Compass

    gem uninstall compass
    gem uninstall sass
    
  2. 安装 Compass将自动安装兼容的 Sass 引擎

    gem install compass
    

回答by Volker Rose

This combination is finally working for me to bring Compass and SASS Sourcemaps together:

这种组合最终对我有用,可以将 Compass 和 SASS Sourcemaps 结合在一起:

Gemfile

文件

gem 'sass', '3.3.0.alpha.149'
gem 'compass', '0.12.2'
gem 'compass-sourcemaps', "~> 0.12.2.sourcemaps.57a186c"

Compass config.rb

指南针配置.rb

sass_options = {:sourcemap => true}

回答by Jürgen Paul

This specific version works well on both:

此特定版本适用于以下两个方面:

gem 'sass', '3.3.0.alpha.149'
gem 'compass', '0.12.2'

They might not be compatible with each other that's why you're getting those errors (considering you're using a bleeding edge version).

它们可能彼此不兼容,这就是您收到这些错误的原因(考虑到您使用的是最新版本)。

回答by raam86

In case you are using Ubuntu it may be a problem with apt-get and rvm colliding.

如果您使用的是 Ubuntu,则可能是 apt-get 和 rvm 冲突的问题。

Try removing rvm with rvm implodeand then run

尝试删除 rvm withrvm implode然后运行

sudo apt-get install ruby-compass 

compass watchworked for me after that.

compass watch在那之后对我来说有效。

回答by Nick F

A variation on the above answers: for me (using Bootstrap for Sass), it turned out to be

上述答案的一个变体:对我来说(使用 Bootstrap for Sass),结果是

gem install bootstrap-sass

that was needed in order to fix this problem. For me, the LoadError problem with Compass started after I updated the version of Ruby I was using.

这是解决这个问题所必需的。对我来说,Compass 的 LoadError 问题是在我更新我使用的 Ruby 版本后开始的。

回答by lfender6445

I believe this is due to versioning conflicts with sass.

我相信这是由于与 sass 的版本冲突。

https://rubygems.org/gems/compassgem is currently at v0.12.16currently - add this to Gemfile

https://rubygems.org/gems/compassgem 当前处于v0.12.16当前状态 - 将此添加到 Gemfile

gem 'sass', '3.2.19'
gem 'compass', '0.12.6'

You may be required to uninstall all versions of both gems first.

您可能需要先卸载这两个 gem 的所有版本。

回答by ice.nicer

I was able to fix it by doing this

我能够通过这样做来修复它

gem uninstall sass
gem install sass -v 3.2.12

This is definitely due to a version dependency issue, you are better off fixing your grunt task to make it forward compatible with the newer versions of saas, compass and so on.

这绝对是由于版本依赖性问题,您最好修复您的 grunt 任务,使其与较新版本的 saas、compass 等向前兼容。

回答by Sérgio

I had the same problem and then I realised that I had two compass versions, so by doing:

我遇到了同样的问题,然后我意识到我有两个指南针版本,所以通过这样做:

compass watchor compass compile

compass watch或者 compass compile

The compiler didn't know which compass version it should use to compile. So, what you can do is explicitly indicate the compass version to work with:

编译器不知道它应该使用哪个指南针版本来编译。因此,您可以做的是明确指出要使用的指南针版本:

compass _1.0.3_ watch

compass _1.0.3_ watch

There's another interesting thread.

还有一个有趣的话题

回答by Nick

I had to setup a gemfile with the correct versions (this error is caused by mismatched SASS and Compass versions, for me). I used thew following with bundle installto fix the problem:

我必须设置一个具有正确版本的 gemfile(对我来说,这个错误是由 SASS 和 Compass 版本不匹配引起的)。我使用以下 withbundle install来解决问题:

source "https://rubygems.org"

gem 'bootstrap-sass', "~> 3.2.0"
gem 'sass', [ "< 3.5" , ">= 3.3.13" ]
gem 'compass', "~> 1.0.1"
gem 'compass-core', "~> 1.0.1"
gem 'compass-import-once', "~> 1.0.5"
gem 'chunky_png', "~> 1.2"
gem 'rb-fsevent', ">= 0.9.3"
gem 'rb-inotify', ">= 0.9"