Search code examples
gradlerhino

less compile with rhino error: org.lesscss.LessException: org.mozilla.javascript.EcmaError: TypeError: Cannot find function bind in object


I got this error when I try to use less-rhino to compile less to css using gradle's lesscss plugin. I tried with different java versions, different rhino versions, even tried to upgrade my os to OS X Yosemite. Nothing helps. Using lessc command line (npm) works.

org.lesscss.LessException: org.mozilla.javascript.EcmaError: TypeError: Cannot find function bind in object
  function _math(fn, unit, n) {
      if (!(n instanceof tree.Dimension)) {
          throw {type:"Argument", message:"argument must be a number"};
      }
      if (unit == null) {
          unit = n.unit;
      } else {
          n = n.unify();
      }
      return new (tree.Dimension)(fn(parseFloat(n.value)), unit);
  }
  . (jar:file:.../lesscss-1.7.0.1.1.jar!/META-INF/less-rhino-1.7.0.js#2926)

Solution

  • So finally i've got an answer:

    Have to remove the old

    /Library/Java/Extensions/js.jar

    file, as it contains rhino 1.7 R2

    (somehow it is stronger than the version on your classpath)