Closed acuarica closed 6 months ago
I tried to fix the issue by changing the platform in environments/build-repository.yaml
. This avoids to compile the Node native module, given it can be found in their respective GitHub releases[1]
repository:
platform: linux/amd64
However, after this change it now gets stuck when running npm run build
from the Dockerfile
=> [repository stage-0 11/11] RUN mkdir /redirects && cd select-contract-form && npm install && npm run build 46.6s
=> => # > react-scripts build && cp -r build/* ../redirects
=> => # Creating an optimized production build...
=> => # Browserslist: caniuse-lite is outdated. Please run:
=> => # npx browserslist@latest --update-db
=> => # Why you should do it regularly:
=> => # https://github.com/browserslist/browserslist#browsers-data-updating
Not sure why this happens. react-scripts build
seems to be quite opaque command, with no verbose option to see what's going on.
Another fail attempt to solve this issue was to try to actually install Python and compile the Node native module. Adding this to the beginning of the Dockerfile
RUN apk add python
# or
# RUN apk add python2
However Python 2 is not available FROM node:14-alpine
1.366 ERROR: unable to select packages:
1.385 python (no such package):
1.385 required by: world[python]
And installing Python 3 raises a syntax error
15.93 gyp ERR! stack Error: Command failed: /usr/bin/python -c import sys; print "%s.%s.%s" % sys.version_info[:3];
15.93 gyp ERR! stack File "<string>", line 1
15.93 gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
15.93 gyp ERR! stack ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
15.93 gyp ERR! stack SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
@acuarica node:14 seems a bit old. Would updating the node version make the needed python version available? Maybe one of the node:18 version Is the main sourcify branch hitting this issue also?
Would updating the node version make the needed python version available? Maybe one of the node:18 version I believe it wouldn't, Python2 was removed from Alpine.
Is the main sourcify branch hitting this issue also?
It doesn't look like. I have checked both these repos https://github.com/ethereum/sourcify and https://github.com/sourcifyeth/h5ai-nginx and found nothing related.
This was solved in the submodule dependency https://github.com/sourcifyeth/h5ai-nginx/commit/80938c49df26994a4bf69e87c626f6d667333657.
Essentially the key was to use node:14.14-alpine
so that python2 make g++
can be installed to compile sass native module.
Following the instruction in the
README
you can build the repository image by runningHowever this fails when running from an Apple ARM-based host, essentially because
python
is not foundBut this Python error is raised because it cannot find a Node native module for the sass package. From the excerpt above
it then tries to compile it, failing because Python is not installed.