Strange build error with yarn add

I’m stuck in a very strange error that completely prevents me from building a rescript react application.

Why or how this error happens is a mystery to me, but to reproduce:

  1. Clone a basic template repo I use for starting a new rescript project: https://github.com/Zeta611/rs-template
  2. yarn install, yarn build:deps, and yarn start will successfully build a project.
  3. Adding a new react library via yarn add react-confetti and yarn install will prevent me from doing yarn build:deps; it results in the following error:
❯ yarn build
yarn run v1.22.19
$ rescript
/bin/sh: rescript: command not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

What’s more irritating is that neither yarn remove nor deleting the project directory and re-cloning solves this issue.
I also tried reinstalling npm and yarn via Homebrew, along with removing the cache directories like ~/.yarn.

I could reproduce it on two of my Macs, and I simply cannot restore my machines to the state where the projects were building properly.
So my questions are

  1. How can I restore my machines so that my projects start building again?
  2. What have I done wrong?

Thank you.

Would this be more suitable at StackOverflow?

Try to install rescript from npm.

But I did yarn add rescript, is that not enough?

You have already installed rescript from github. I’m not sure that it’s going to work correctly, so try to update the line to:

"rescript": "10.1.0",

And reinstall dependencies.

What’s inside .yarnrc.yml ?

Are you using node-modules as a node linker?

Thank you, this saved the day(s)! I’m not sure why installing from GitHub does not work properly—and it does without adding additional deps—, but I’m super happy to see that 10.1.0 has just been released on the perfect time :slight_smile:

I do not have .yarnrc.yml, so I’m probably using the default pnp? Thank you for the response!