aantron / bisect_ppx

Code coverage for OCaml and ReScript
http://aantron.github.io/bisect_ppx/demo/
MIT License
302 stars 60 forks source link

Cannot install with pnpm #381

Closed Toxaris closed 2 years ago

Toxaris commented 3 years ago

When trying to install a package with a dependency to bisect_ppx with recent versions of pnpm, I get an error:

ENOENT: no such file or directory, chmod '.../node_modules/.pnpm/bisect_ppx@2.6.3/node_modules/bisect_ppx/bisect-ppx-report'

This happens because bisect_ppx assumes that the preinstall script can create the file mentioned in bin, but pnpm assumes that the preinstall script can already call the file mentioned in bin. There is a similar issue for installing bisect_ppx with yarn, but while yarn just seems to skip the missing file, pnpm errors out. So the workaround from bisect_ppx#290 (essentially to run yarn a second time) does not work for us with pnpm.

I reported this in pnpm#3817 and got the advice:

preinstall, install, postinstall are all executed after the real installation, and bin may be used in these scripts so they need to be created before the execution, see pnpm#3760, pnpm#3763. I think bisect_ppx may need to be updated to work with the latest pnpm/yarn/npm.

aantron commented 2 years ago

https://github.com/aantron/bisect_ppx/commit/e7234712327c953e3fcd064b2b415d6c366518ae fixes the issue by distributing a dummy binary in the place where bisect-ppx-report will be copied to. This allows the install to proceed, and the delayed pretinstall script replaces the dummy binary with the right binary after install.