Missing python3 and cpu-feauture (optional) dependencies when doing docker deployment.
See original GitHub issueFollowed this guide an created 2 images with a separate frontend. I get 2 dependencies errors using the provided Dockerfiles (everything out of the box). Issue happens on Backend and frontend. Do I need to install python3 ? it’s not specified on the instructions
[5/5] Building fresh packages… warning Error running install script for optional dependency: "/app/node_modules/cpu-features: Command failed. Exit code: 1 Command: node-gyp rebuild Arguments: Directory: /app/node_modules/cpu-features Output: gyp info it worked if it ends with ok gyp info using node-gyp@5.1.0 gyp info using node@14.18.0 | linux | x64 gyp ERR! find Python gyp ERR! find Python Python is not set from command line or npm configuration gyp ERR! find Python Python is not set from environment variable PYTHON gyp ERR! find Python checking if "python" can be used gyp ERR! find Python - "python" is not in PATH or produced an error gyp ERR! find Python checking if "python2" can be used gyp ERR! find Python - "python2" is not in PATH or produced an error gyp ERR! find Python checking if "python3" can be used gyp ERR! find Python - "python3" is not in PATH or produced an error gyp ERR! find Python gyp ERR! find Python ********************************************************** gyp ERR! find Python You need to install the latest version of Python. gyp ERR! find Python Node-gyp should be able to find and use Python. If not, gyp ERR! find Python you can try one of the following options: gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable" gyp ERR! find Python (accepted by both node-gyp and npm) gyp ERR! find Python - Set the environment variable PYTHON gyp ERR! find Python - Set the npm configuration variable python: gyp ERR! find Python npm config set python "/path/to/pythonexecutable" gyp ERR! find Python For more information consult the documentation at: gyp ERR! find Python https://github.com/nodejs/node-gyp#installation gyp ERR! find Python ********************************************************** gyp ERR! find Python gyp ERR! configure error gyp ERR! stack Error: Could not find any Python installation to use gyp ERR! stack at PythonFinder.fail (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:307:47) gyp ERR! stack at PythonFinder.runChecks (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:136:21)
Steps to Reproduce
- npx @backstage/create-app (Node v14.15.5)
- select postgresql as your db, I think it also happens on sqlite
- CI is using ubuntu:latest but I also tested it on centos7
- docker build . -f packages/backend/Dockerfile --tag backstage
- Same error happens when you build the frontend
Backend Dockerfile
FROM node:14-buster-slim
WORKDIR /app
COPY yarn.lock package.json packages/backend/dist/skeleton.tar.gz ./
RUN tar xzf skeleton.tar.gz && rm skeleton.tar.gz
RUN yarn install --frozen-lockfile --production --network-timeout 300000 && rm -rf "$(yarn cache dir)"
COPY packages/backend/dist/bundle.tar.gz app-config.yaml ./
RUN tar xzf bundle.tar.gz && rm bundle.tar.gz
CMD ["node", "packages/backend", "--config", "app-config.yaml"]
Frontend Dockerfile
FROM node:14-buster AS build
RUN mkdir /app
COPY . /app
WORKDIR /app
RUN yarn install
RUN yarn workspace app build
FROM nginx:mainline
RUN apt-get update && apt-get -y install jq && rm -rf /var/lib/apt/lists/*
COPY --from=build /app/packages/app/dist /usr/share/nginx/html
COPY docker/default.conf.template /etc/nginx/templates/default.conf.template
COPY docker/inject-config.sh /docker-entrypoint.d/40-inject-config.sh
ENV PORT 80
Everything is built using create-app and deployment using docker with a separate image in the frontend.
Yarn.lock has the cpu-feature dependency
cpu-features@0.0.2:
version "0.0.2"
resolved "https://registry.yarnpkg.com/cpu-features/-/cpu-features-0.0.2.tgz#9f636156f1155fd04bdbaa028bb3c2fbef3cea7a"
integrity sha512-/2yieBqvMcRj8McNzkycjW2v3OIUOibBfd2dLEJ0nWts8NobAxwiyw9phVNS6oDL8x8tz9F7uNVFEVpJncQpeA==
dependencies:
nan "^2.14.1"
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (6 by maintainers)
Top Related StackOverflow Question
I’m running into this as well, out of the box installation results in a failed docker build:
#10 73.96 error /app/node_modules/@vscode/sqlite3: Command failed.
and then a lot of node-gyp output trying to find Python.
Having the same problem. But installing python, cmake and g++ in the production image is not really an option, right? It fixes the issue of the dependencies, but then you have compilers in the image which could pose a security risk.
@backstage-team: Any chance that
@vscode/sqlite3will be defined as an optional dependency again?