Understanding `Error: spawnSync rescript.exe ENOENT`

I’m working on a flake.nix file, for a monorepo, and my OS is nixos.

My current hypothesis re the spawnSync error is that it has to do with write access to tmp directories, and nix is doing something that not every linux does with permissions. Is this hypothesis at all reasonable?

When my yarn command works it’s way down to rescript build -with-deps, I get this

> $ rescript build -with-deps
> warning Cannot find a suitable global folder. Tried these: "/usr/local, /homeless-shelter/.yarn"
> Error: spawnSync /nix/store/zllzvzv0m802za9y453vpl826rm5brzp-quri-squiggle-lang-modules-0.2.11/node_modules/rescript/linux/rescript.exe ENOENT

--global-folder flag from yarn doesn’t seem to interact with the rescript executable.

I should note that (modulo some patchelf work and running yarn from within an FHS shell, though I’m pretty sure the FHS is for something other than rescript), I can build and develop rescript on my machine (which is nixos), the problem is in the particular sandbox that the flake is building in)

Another question:

I’m not familiar with mkYarnPackage, but it seems like your patchelf invocation is too late. ReScript checks that the binary works during installation.

Did you ever fix this @quinn-dougherty ? I’m facing a similar issue trying to deploy a rescript app on Azure.

Error: spawnSync /home/site/wwwroot/node_modules/.bin/linux/rescript.exe ENOENT
This happens when running rescript build -with-deps

I know I’m in the right folder when this is ran :smiley: I’m using Azure App Service. I wonder if the environment isn’t setup right for Rescript? Seems like an obvious question, but then I look at Rescript Installation Guide and it doesn’t mention anything about specific steps to setup environment outside of Node and npm. This is Node 16 on the remote machine. Maybe I should try using the latest Rescript? I’m on 9.1, but I worry about the major version upgrade :grimacing: