npm安装更少来自ruby的抛出错误

时间:2014-05-31 11:45:48

标签: node.js gem rubygems less npm

我正在尝试使用较少的getting started guide

我成功运行sudo npm install -g less,结尾于:

/usr/bin/lessc -> /usr/lib/node_modules/less/bin/lessc
less@1.7.0 /usr/lib/node_modules/less
├── mime@1.2.11
├── mkdirp@0.3.5
├── source-map@0.1.33 (amdefine@0.1.0)

但是当我尝试使用lessc时,我从Ruby得到错误:

$ lessc 
/home/jasonshark/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:298:in `to_specs': Could not find 'less' (>= 0) among 153 total gem(s) (Gem::LoadError)
    from /home/jasonshark/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:309:in `to_spec'
    from /home/jasonshark/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
    from /home/jasonshark/.rvm/gems/ruby-2.0.0-p247/bin/lessc:22:in `<main>'
    from /home/jasonshark/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `eval'
    from /home/jasonshark/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `<main>'

这场冲突是什么?如何解决?

我的$PATH变量是:

$ echo $PATH
/home/jasonshark/.rvm/gems/ruby-2.0.0-p247/bin:/home/jasonshark/.rvm/gems/ruby-2.0.0-p247@global/bin:/home/jasonshark/.rvm/rubies/ruby-2.0.0-p247/bin:/home/jasonshark/.rvm/bin:/home/jasonshark/.rvm/bin:/home/jasonshark/Code/adt-bundle-linux-x86-20131030/sdk/tools:/home/jasonshark/Code/adt-bundle-linux-x86-20131030/sdk/platform-tools:/usr/local/heroku/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/jasonshark/.rvm/bin

1 个答案:

答案 0 :(得分:3)

Ruby gem less与npm模块lessc冲突。 gem和npm模块都包含可执行文件lessc。由于RVM将Ruby bin目录附加到路径的前面,因此当您打算运行npm lessc命令时,您正在运行Ruby lessc命令。

要修复,请运行/usr/bin/lessc。这更明确,将避免调用Ruby lessc