ReScript "Module X not found" in CI
The ReScript compiler reached a module reference it cannot resolve. The dependency is missing from the bs-dependencies in rescript.json (or bsconfig.json), or the npm package was never installed.
What this error means
rescript build fails with "The module or file X can't be found." and lists where it looked, often suggesting the dependency is not declared.
We've found a bug for you!
/src/App.res:2:8-19
The module or file Belt_Array can't be found.
- Did you add it to the bs-dependencies in rescript.json?Common causes
The dependency is not in rescript.json
A package providing the module is installed in node_modules but not listed in bs-dependencies, so the compiler does not include it.
The npm package is not installed
The dependency is referenced but npm install never ran or did not fetch it, so the module source is absent.
How to fix it
Add the dependency to rescript.json
- Install the npm package that provides the module.
- Add it to
bs-dependenciesin rescript.json. - Re-run
rescript build.
{
"bs-dependencies": ["@rescript/core"]
}Install dependencies before building
Ensure npm ci runs before rescript build so every declared dependency is present in node_modules.
npm ci
npx rescript buildHow to prevent it
- Keep
bs-dependenciesin sync with the packages your code imports. - Run
npm cibeforerescript buildin CI. - Use a clean build (
rescript clean) when switching dependency versions.