(js_of_ocaml) how to solve "Error: Unbound module Js"?

(js_of_ocaml) how to solve "Error: Unbound module Js"?

我想重新编译一组文件以在我的 Mac 中生成一个 .js 文件。以前可以用(很久以前),不知道为什么现在不行了。

它返回:

$ make analyzejs
ocamlfind ocamlc -g unix.cma -package js_of_ocaml.ppx -I /Users/chengtie/lib -I hack -I functor -I params -I concrete -I pd -I ai -I domains -I frontend -I frontend/gen -I syntax -I lib -I main -I rules -I area -I values -I vars -I zones -I microsoft -I experiment -I expression -I abstract -I operator -I ev -I js -I /Users/chengtie/.opam/4.02.3/lib/xmlm -annot -c lib/array2_js.ml
File "lib/array2_js.ml", line 17, characters 50-54:
Error: Unbound module Js

我的lib/array2_js.ml:

open Array2

module Array2_js:
  sig
    val of_js: (('a Js.js_array Js.t) Js.js_array Js.t) -> ('a -> string) ->
      string array array
    val of_js_shift :int -> int -> 'b ->
      (('a Js.js_array Js.t) Js.js_array Js.t) -> ('a -> 'b) -> 'b array array
    val of_js_f2_shift: int -> int -> 'b ->
      (('a Js.js_array Js.t) Js.js_array Js.t) ->
      (('a Js.js_array Js.t) Js.js_array Js.t) ->
      ('a -> 'a -> 'b) -> 'b array array
  end
=
struct
  (* {can better}: don't know why f:'a -> 'b is not permitted; *)
  let of_js (s: ('a Js.js_array Js.t) Js.js_array Js.t) (f: 'a -> string) :
    string array array =
    let s = Js.to_array s in
    let num_rows = Array.length s in
    let num_columns = Array.length (Js.to_array s.(0)) in
    (* pffo "num_rows_1: %d, num_columns_1: %d\n" num_rows num_columns; *)
    let t = Array2.make num_rows num_columns "" in
$ js_of_ocaml --version returned 3.5.2.

有人能帮忙吗?

  1. open Js_of_ocaml 在 array2_js.ml
  2. 的顶部
  3. 使用 -package js_of_ocaml-ppx 更新命令行(而不是 -package js_of_ocaml.ppx