grunt不再工作了,可能是因为宝石路径

时间:2016-01-29 22:32:56

标签: ruby macos gruntjs npm rubygems

所以Grunt曾经在我的Mac OSX El Capitan上工作得很好。几天前,我安装了Jekyll,然后当我回到另一个已经使用过Grunt的项目时,突然发现了这些错误。

Haneens-MacBook-Pro:hk-2015-v2 HRK$ grunt
/Users/HRK/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'grunt' (>= 0) among 24 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/Users/HRK/.rvm/gems/ruby-2.2.1:/Users/HRK/.rvm/gems/ruby-2.2.1@global', execute `gem env` for more information
    from /Users/HRK/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/dependency.rb:324:in `to_spec'
    from /Users/HRK/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:64:in `gem'
    from /Users/HRK/.rvm/rubies/ruby-2.2.1/bin/grunt:22:in `<main>'
    from /Users/HRK/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `eval'
    from /Users/HRK/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `<main>'

我尝试将npm的路径编辑为usr/local/bin 所以我编辑了etc / paths文件以获得以下内容

/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin

我该如何解决这个问题?我是初学者,非常令人沮丧!

1 个答案:

答案 0 :(得分:0)

首先尝试:

gem list

查看您是否安装了grunt

然后你可以通过以下方式解决问题:

gem env

寻找GEM PATHS,看看它是否是您安装宝石的路径。

然后你可以使用

export GEM_PATH=/path/to/your/gem/dir

添加正确的路径。