When upgrading to alpine 3.19, we found that we could no longer build the native bcrypt package because the npm rebuild
command would fail with:
invalid mode: 'rU' while trying to load binding.gyp
This is caused by the antiquated Node14/npm 6 version that meteor uses and the final removal of the deprecated “U” flag in Python 3.11. Read more here.
To fix this, you can patch the input.py file in place, e.g. in your Dockerfile before building native packages:
ENV PATCHED_INPUT_PY_PATH="$NODE_PATH/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py"
RUN sed -i "s/'rU'/'r'/g" "$PATCHED_INPUT_PY_PATH"
Hope this helps someone
/Per