Connor Leech
Connor Leech

Reputation: 18833

npm install less throws error from ruby

I am trying to use the less, following their getting started guide

I successfully ran sudo npm install -g less that ended with:

/usr/bin/lessc -> /usr/lib/node_modules/less/bin/lessc
[email protected] /usr/lib/node_modules/less
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])

but when I try using lessc I get an error from 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>'

What's this conflict and how do I fix it?

My $PATH variable is:

$ 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

Upvotes: 1

Views: 384

Answers (1)

Curley
Curley

Reputation: 1621

The Ruby gem less is in conflict with the npm module lessc. both the gem and the npm module contain an executable lessc. Since RVM is appending the Ruby bin directories to the front of your path, you are running the Ruby lessc command when you are intending to run the npm lessc command.

To fix, run /usr/bin/lessc. This is more explicit and will avoid invoking the Ruby lessc.

Upvotes: 3

Related Questions