
Software engineer @NetScaler @citrix. Tech co-founder @Susurrus_io. Web development, infosec, tech
- Tweets369
- Following870
- Followers197
- Likes1.5K

ALT The dockerfile you gave gives me this error message: #17 39.01 npm ERR! gyp ERR! find Python Python is not set from command line or npm configuration How can I avoid it? This error message indicates that the node-gyp package, which is used to build native Node.js modules, is unable to find a Python installation on the system. To fix this error, you can specify the path to a Python installation in the npm_config_python environment variable. For example: Copy code RUN npm config set python /usr/bin/python3 Alternatively, you can install Python on your system using the apt-get package manager, as follows: Copy code RUN apt-get update && \ apt-get install -y python3 Once you have installed Python, you should be able to build native Node.js modules without encountering this error.

ALT [email protected] This error only occurs locally. When running docker build in CI I don't get this error. Why? The node-gyp package requires a Python installation to build native Node.js modules. It appears that your local environment does not have a Python installation, which is why you are seeing this error. However, the continuous integration (CI) environment in which you are running the docker build command likely does have a Python installation, which is why you are not seeing this error in CI. To avoid this error in your local environment, you can install Python on your system and specify the path to the Python binary in the npm_config_python environment variable, as described in the previous response. This will ensure that node-gyp is able to find a Python installation and build native Node.js modules successfully.

ALT But the error happens from within the docker build command so it's happening in an isolated environment when building the docker image isn't it? When you run the docker build command, Docker creates a temporary environment in which to build the Docker image. This environment is isolated from your local environment, but it is still an operating system with its own dependencies and configuration. In this case, it appears that the temporary environment does not have a Python installation, which is why you are seeing this error. To fix this error, you can specify the path to a Python installation in the npm_config_python environment variable, as described in the previous response. This will ensure that node-gyp is able to find a Python installation and build native Node.js modules successfully. Alternatively, you can install Python in the temporary environment by adding the appropriate apt-get commands to your Dockerfile. This will ensure that the temporary environment has all the nece


















