js_of_ocaml.ppx不被发现

问题描述:

我试图运行js_of_eliom,但它似乎没有ppx_deriving 这是我得到的消息时,我做了补充:js_of_ocaml.ppx不被发现

js_of_eliom -ppx -c -package lwt -package js_of_ocaml.deriving -package js_of_ocaml.ppx simple_pomodoro.eliom 
Fatal error: exception Fl_package_base.No_such_package("js_of_ocaml.ppx", "") 
make: *** [_client/simple_pomodoro.cmo] Error 2 

当我做一个ocamlfind查询js_of_ocaml.ppx我得到这个:

ocamlfind: Package `js_of_ocaml.ppx' not found 

但我已经安装了ppx_deriving,OPAM列表显示了它:

ppx_deriving   3.3 Type-driven code generation for OCaml >=4.02 

我在el el capitan的mac osx上运行(10.11) 任何想法为什么会发生这种情况?

编辑

哦对不起我有js_of_ocaml也装了,请问这是什么出现在我的ocamlfind:

λ ~/ ocamlfind list | grep js_of_ocaml 
js_of_ocaml   (version: 2.7) 
js_of_ocaml.compiler (version: [distributed with js_of_ocaml]) 
js_of_ocaml.compiler.with_findlib (version: n/a) 
js_of_ocaml.deriving (version: [distributed with js_of_ocaml]) 
js_of_ocaml.deriving.ppx (version: [distributed with js_of_ocaml]) 
js_of_ocaml.deriving.syntax (version: [distributed with js_of_ocaml]) 
js_of_ocaml.graphics (version: [distributed with js_of_ocaml]) 
js_of_ocaml.log  (version: [distributed with js_of_ocaml]) 
js_of_ocaml.ocamlbuild (version: [distributed with js_of_ocaml]) 
js_of_ocaml.syntax (version: [distributed with js_of_ocaml]) 
js_of_ocaml.toplevel (version: [distributed with js_of_ocaml]) 
js_of_ocaml.tyxml (version: [distributed with js_of_ocaml]) 
js_of_ocaml.weak (version: [distributed with js_of_ocaml]) 

ppx_deriving是一个驱动程序,管理不同derivers。它本身并不提供任何。您需要安装js_of_ocaml导出器,也就是js_of_ocaml包的一部分:

opam install js_of_ocaml 

因此你将有:

$ ocamlfind list | grep js_of_ocaml.ppx 
js_of_ocaml.ppx  (version: [distributed with js_of_ocaml]) 
js_of_ocaml.ppx.internal (version: [distributed with js_of_ocaml]) 

我发现了一个解决方案,它在ocsigen问题通过GitHub的报告 https://github.com/ocsigen/eliom/issues/251

我这样做:

  • 我已重新安装opam(v.1.2.2),重新初始化,安装4.02.3,utop & eliom。它仍然没有工作。然后我安装了deriving_ppx.3.0.0,就像你在SO中提到的那样,现在它工作正常。谢谢 !