' grunt compass'抛出它不在系统路径中的错误

时间:2014-04-30 12:48:18

标签: sass gruntjs

我很擅长使用grunt,指南针和sass,并且无法使用它。我有一个使用Drupal 7的Redhat安装,当我尝试从站点的主题目录中运行'grunt compass'时,我收到以下错误:

Running "compass:dist" (compass) task
Warning: You need to have Ruby and Compass installed and in your system PATH for this task     to work. More info: https://github.com/gruntjs/grunt-contrib-compass Use --force to continue.

Aborted due to warnings.

我已经安装了Grunt,Bower,并使用'bundle install'来安装所需的宝石。当我运行'gem list'时,我得到以下内容:

bigdecimal (1.2.4)
breakpoint (2.0.7)
bundler (1.6.2)
bundler-unload (1.0.2)
chunky_png (1.3.1)
compass (0.12.6)
compass-normalize (1.4.3)
executable-hooks (1.3.1)
fssm (0.2.10)
gem-wrappers (1.2.4)
io-console (0.4.2)
json (1.8.1)
kss (0.5.0)
minitest (4.7.5)
psych (2.0.3)
rake (10.1.0)
rdoc (4.1.0)
ruby (0.1.0)
rubygems-bundler (1.4.3)
rubygems-update (2.2.2)
rvm (1.11.3.9)
sass (3.2.19)
test-unit (2.1.1.0)
zurb-foundation (4.3.2)

所以看来我拥有所有需要的宝石。然后我通过'echo $ PATH'查看了我的PATH设置,得到了以下内容:

/home/ec2-user/.rvm/gems/ruby-2.1.1/bin:/home/ec2-user/.rvm/gems/ruby-2.1.1@global/bin:/home/ec2-user/.rvm/rubies/ruby-2.1.1/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/aws/bin:/home/ec2-user/bin:/home/ec2-user/.rvm/bin

我查看了路径并看到在/ usr / bin中我有ruby2.0并且在/ home / ec2-user / bin我有指南针所以安装似乎在系统路径中。

当我从命令行运行'ruby2.0'时,我得到以下内容:

/usr/local/share/ruby/site_ruby/2.0/rubygems/ext/builder.rb:12:in `<class:Builder>':  uninitialized constant Gem::UserInteraction (NameError)
from /usr/local/share/ruby/site_ruby/2.0/rubygems/ext/builder.rb:10:in `<top (required)>'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/ext.rb:13:in `<top (required)>'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/specification.rb:1431:in `build_extensions'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/stub_specification.rb:60:in `build_extensions'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/basic_specification.rb:56:in `contains_requirable_file?'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/specification.rb:925:in `block in    find_inactive_by_path'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/specification.rb:924:in `each'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/specification.rb:924:in `find'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/specification.rb:924:in `find_inactive_by_path'
from /usr/local/share/ruby/site_ruby/2.0/rubygems.rb:185:in `try_activate'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/core_ext/kernel_require.rb:132:in `rescue in require'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/core_ext/kernel_require.rb:144:in `require'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/user_interaction.rb:8:in `<top (required)>'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/config_file.rb:7:in `<top (required)>'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/specification.rb:1430:in `build_extensions'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/stub_specification.rb:60:in `build_extensions'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/basic_specification.rb:56:in `contains_requirable_file?'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/specification.rb:925:in `block in find_inactive_by_path'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/specification.rb:924:in `each'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/specification.rb:924:in `find'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/specification.rb:924:in `find_inactive_by_path'
from /usr/local/share/ruby/site_ruby/2.0/rubygems.rb:185:in `try_activate'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/core_ext/kernel_require.rb:132:in `rescue in require'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/core_ext/kernel_require.rb:144:in `require'
from <internal:abrt_prelude>:2:in `<compiled>'

当我简单地跑'红宝石'时,什么都没有发生。 'grunt指南针'是否正在寻找'红宝石',而我却拥有'ruby2.0'?我是否需要使用ruby创建符号链接 - &gt; ruby2.0?

当我从命令行运行'compass'时,我得到:

用法:指南帮助[命令]

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.

任何想法都将不胜感激

3 个答案:

答案 0 :(得分:1)

我已经对此进行了一些研究,以下内容对我有用......

如果您通过CLI安装了Ruby和Compass的Windows版本,请尝试;

  • 控制面板&gt;系统&gt;高级系统设置
  • 高级&gt;环境变量
  • 在系统变量下搜索“path”变量,该变量应具有值
  • 最后点击编辑并在变量值的最后添加;C:\Ruby193\bin

这应该可以解决问题。

请注意;C:\Ruby193\bin指的是Ruby&gt;的安装。指南针在你的机器上。

如果您有Mac版本,那么类似版本的修补程序可能适用于Mac,但我无法为您映射,谷歌搜索可能会有所帮助......

答案 1 :(得分:0)

grunt compass寻找红宝石宝石。在你的情况下'罗盘-v'没有错误,所以指南针部分工作正常。除此之外,它不依赖于红宝石的任何其他组成部分。

现在指南针准备就绪,grunt compass还会查找npm模块grunt-contrib-compass,您可以在package.json文件中找到它。如果您执行了npm install这个npm包已安装,我相信它应该使grunt compass正常工作。

答案 2 :(得分:0)

grunt-contrib-compass有一个发出魔法的bundleExec选项。使用bundle,它将加载使用bundle install安装的gem。只需设置bundleExec:true

即可

https://github.com/gruntjs/grunt-contrib-compass#bundleexec