Rescript build -with-deps --> refmt.exe not found

Hi,

I’m trying to build one of my rescript projects, in a docker image, but at the npm install stage, I get the following error:

> rescript build -with-deps
...
FAILED: src/api.ast
sh: /home/app/node_modules/rescript/linux/refmt.exe: not found

  We've found a bug for you!
  /home/app/src/api.re

  There's been an error running Reason's parser on a file.
  If the message doesn't help, check for errors slightly above.
  Please file an issue on github.com/facebook/reason. Thanks!

FAILED: cannot make progress due to previous errors.

I believe that I just miss some library somewhere or use the wrong version of something. Here is my Dockerfile :

FROM node:19-alpine

WORKDIR /home/app

RUN apk --update --upgrade --no-cache add bash cairo-dev make pango-dev gdk-pixbuf curl && 
\
  ln -s /usr/bin/python3 /usr/bin/python

COPY package.json ./

COPY bsconfig.json ./

COPY src ./src

COPY __tests__ ./__tests__

RUN apk add --no-cache --virtual .build-deps gcc g++ python3-dev musl-dev jpeg-dev zlib-dev
 libffi-dev
RUN npm install

Has anyone any idea how to resolve this ?

Thanks !

what version of rescript are you using? Reason syntax is being deprecated, did you try converting your project to Rescript syntax and see if it fixed it?

In my package.json:

  "devDependencies": {
    "rescript": "^10.0.1",

I didn’t know I had used a reason syntax… Why don’t the compiler just indicate the syntax errors then ?
I’m going to try that conversion. Is there a pointer to the procedure to do that ?

Well, that’s unexpected :thinking:

npx rescript convert src/api.re 
Error when converting src/api.re
don't know what to do with src/api.re

That file is really simple, maybe you can tell me what syntax error it contains:

open Express
open Routes

let app = express()
let port = 3000

App.get(app, ~path="/", healthCheck)
App.get(app, ~path="/compile/", postCompile)

let server = App.listen(
  app,
  ~port,
  ~onListen=_ => {
    Js.log(`Listening at http://localhost:${Js.Int.toString(port)}`)
  },
  (),
)

Actually, it looks like ReScript syntax (the new one), but the file extension says it’s ReasonML. Can you try simply renaming it to api.res?

2 Likes

All right, that was it. I don’t get how I ended with the wrong extension, but I would expect a more explicit error in that case.

3 Likes