     res.on 'end', ->
       pkginfo = JSON.parse val
       versions = (key for own key, value of pkginfo.versions)
-      version = semver.maxSatisfying versions, version
+      version = semver.maxSatisfying versions, range
       deps = pkginfo.versions[version].dependencies ? {}
       (generateExpr(nm, ver) unless generated[nm + "-" + ver]?) for nm, ver of deps
       http.get "http://registry.npmjs.org/#{name}/-/#{name}-#{version}.tgz", (res) ->

          hash.update chunk
        res.on 'end', ->
          console.log """
            #{}  "#{name}" = self."#{name}-#{version}";

              "#{name}-#{version}" = self.buildNodePackage rec {
                name = "#{name}-#{version}";
                src = fetchurl {
                  url = "http://registry.npmjs.org/#{name}/-/${name}.tgz";


generated = {}

generateExpr = (name, range) ->
   generated[name + "-" + range] = true
   http.get "http://registry.npmjs.org/#{name}", (res) ->
    res.setEncoding()
    val = ""
