TheSpyder / rescript-mocha

Mocha bindings for ReScript
MIT License
0 stars 2 forks source link

Avoid `mkdir` #3

Closed quinn-dougherty closed 2 years ago

quinn-dougherty commented 2 years ago

In nix, I can't build a rescript package that depends on mocha.

> nashwires@0.0.1 build:rescript /build/nashwires
> rescript

Dependency on rescript-mocha
Fatal error: exception Unix.Unix_error(Unix.EACCES, "mkdir", "/build/nashwires/node_modules/rescript-mocha/lib")
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! nashwires@0.0.1 build:rescript: `rescript`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the nashwires@0.0.1 build:rescript script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Is there a way I can avoid mkdir? Note this failure is at the stage of calling the rescript executable to build, not even running tests yet.

With nix and flakes, you can reproduce by cloning (checkout 70afaebb8e8578ab8fbafda2a5d088e0a3feaf4e) and running nix build .#nashwires

quinn-dougherty commented 2 years ago

Solved

configurePhase = ''
          cp -r ${nodeDependencies}/lib/node_modules .
          export PATH="${nodeDependencies}/bin:$PATH"
          chmod -R +w node_modules
          mkdir -p node_modules/rescript-fast-check/lib
        '';
TheSpyder commented 2 years ago

This is a ReScript limitation, there's nothing I as a library author can do to work around it.