`scripts/ninja.js config` detects cycle

While building from source, scripts/ninja.js config fails with the following error:

scripts/ninja.js:1353
      throw new Error(`cycle: ${path.concat(current).join(" ")}`);
      ^

Error: cycle: ext/ext_ident.cmx ext/hash_string.cmx ext/hash_gen.cmx ext/hash.cmx ext/hash_gen.cmx

ext/hash_gen.cmx appears twice in the line above.

you need do opam switch 4.10.2+rescript