Flow: Not working in node:alpine

Created on 26 Feb 2019  路  6Comments  路  Source: facebook/flow

I was trying to set up a CI flow job with the node:alpine (currently 11.10) image since it's very common for CI usage.
I realized that I get the following error when trying to run flow in a node:alpine container:

events.js:173
      throw er; // Unhandled 'error' event
      ^

Error: spawn /app/node_modules/flow-bin/flow-linux64-v0.93.0/flow ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:246:19)
    at onErrorNT (internal/child_process.js:427:16)
    at processTicksAndRejections (internal/process/next_tick.js:76:17)
    at process.runNextTicks [as _tickCallback] (internal/process/next_tick.js:51:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:804:11)
    at internal/main/run_main_module.js:21:11
Emitted 'error' event at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:252:12)
    at onErrorNT (internal/child_process.js:427:16)
    [... lines matching original stack trace ...]
    at internal/main/run_main_module.js:21:11

Using a "normal" image like node:latest everything works fine,

Flow version: 0.93.0

Steps to reproduce

docker run -it node:alpine sh
mkdir app && cd app
yarn init
yarn add -D flow-bin
yarn flow 
Crash bug

Most helpful comment

As mentioned in #139 Alpine uses musl as a standard C library and apparently it's is missing something that flow uses. It would be good to check this requirements by someone with C knowledge. There are dity hacks that can temporarily allow you to run Flow on Alpine like this one https://github.com/facebook/flow/issues/1605 and this one https://github.com/facebook/flow/issues/3649. I have not enough C experience to understand how this project works, thus I'm asking someone to take a look.

All 6 comments

Having this exact issue. Trying to run with [flow-bin 0.92.0]:

node ./node_modules/flow-bin/cli

... Runs normally on my Linux Mint, but fails @ CI with Linux Alpine. Is there some library that Flow requires?

@neutraali @erksch Try to set max workers like here guys
https://github.com/atlassian/react-beautiful-dnd/issues/1007#issuecomment-446415426

And please tell us if the problem is fixed.

Unfortunately that did not seem to have any effect. Steps taken:

  1. Create a copy of .flowconfig named .flowconfig-ci and add the server.max_workers=1 -entry under [options]
  2. Run with node ./node_modules/flow-bin/cli --flowconfig-name .flowconfig-ci
  3. Under node:10-alpine results in same error:
events.js:167 throw er; // Unhandled 'error' event
Error: spawn /path/to/node_modules/flow-bin/flow-linux64-v0.92.0/flow ENOENT

As mentioned in #139 Alpine uses musl as a standard C library and apparently it's is missing something that flow uses. It would be good to check this requirements by someone with C knowledge. There are dity hacks that can temporarily allow you to run Flow on Alpine like this one https://github.com/facebook/flow/issues/1605 and this one https://github.com/facebook/flow/issues/3649. I have not enough C experience to understand how this project works, thus I'm asking someone to take a look.

Same error - Alpine Linux

$ strace /home/sergeykish/wat/flow/node_modules/flow-bin/flow-linux64-v0.124.0/flow
execve("/home/sergeykish/wat/flow/node_modules/flow-bin/flow-linux64-v0.124.0/flow", ["/home/sergeykish/wat/flow/node_m"...], 0x7fffcaad24e0 /* 19 vars */) = -1 ENOENT (No such file or directory)
strace: exec: No such file or directory

Error message should be

ENOENT The file filename or a script or ELF interpreter does not exist, or a shared library needed for file or interpreter cannot be found.

$ ldd /home/sergeykish/wat/flow/node_modules/flow-bin/flow-linux64-v0.124.0/flow
        /lib64/ld-linux-x86-64.so.2 (0x7fd59b10c000)
        libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7fd59b10c000)
        librt.so.1 => /lib64/ld-linux-x86-64.so.2 (0x7fd59b10c000)
        libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7fd59b10c000)
        libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7fd59b10c000)
        libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7fd59b10c000)
Error relocating /home/sergeykish/wat/flow/node_modules/flow-bin/flow-linux64-v0.124.0/flow: __strdup: symbol not found

I have no such libraries

I've tried https://github.com/facebook/flow/issues/1605#issuecomment-403242700

apk add --repository https://nl.alpinelinux.org/alpine/edge/testing flow

It starts, except now I have WSL issue https://github.com/flowtype/flow-bin/issues/132

[2020-05-14 15:12:02.369] argv=/usr/bin/flow start --temp-dir /tmp/flow /home/sergeykish/wat/flow
[2020-05-14 15:12:02.371] We've run out of filesystems to use for shared memory
Out of shared memory:
Raised by primitive operation at file "hack/heap/sharedMem.ml", line 95, characters 6-68
Was this page helpful?
0 / 5 - 0 ratings