Search code examples
pythongitdockerdivio

Divio Cloud deployment error: ENOGIT git is not installed or not in the PATH


I updated all my add ons and Python version at the Divio Control Dashboard to the recommended versions and after that I can't deploy my project. The error message is:

 ---> Running in fb3fc5000391
[91mbower bootstrap-sass-official#3.3.5           ENOGIT git is not installed or not in the PATH

Stack trace:
Error: git is not installed or not in the PATH
    at createError (/opt/nvm/versions/node/v6.10.1/lib/node_modules/bower/lib/util/createError.js:4:15)
    at GitHubResolver.GitResolver (/opt/nvm/versions/node/v6.10.1/lib/node_modules/bower/lib/core/resolvers/GitResolver.js:45:15)
    at GitHubResolver.GitRemoteResolver (/opt/nvm/versions/node/v6.10.1/lib/node_modules/bower/lib/core/resolvers/GitRemoteResolver.js:10:17)
    at new GitHubResolver (/opt/nvm/versions/node/v6.10.1/lib/node_modules/bower/lib/core/resolvers/GitHubResolver.js:13:23)
    at /opt/nvm/versions/node/v6.10.1/lib/node_modules/bower/lib/core/resolverFactory.js:20:16```

Solution

  • The issue you're seeing is that when the Docker image is built and the commands in the Dockerfile are executed, something needs Git, but can't find it.

    What you need to install

    You need to install Git, which you can do in the Dockerfile with:

    RUN apt-get update && \
        apt-get install -y git
    

    Where to run the command

    You need to run it before the command that requires Git.

    In fact since Git is quite a low level command, often used in installation processes, you want to install it as early as possible, for example, as soon as possible after the FROM command that specifies the base image.

    See How to install system packages in a project in the Divio documentation.

    Why you need to do this now

    You mention that you updated the Python version of your project. In Divio Cloud projects, this can be done via the Control Panel. The latest versions of Divio Python base projects include slimmed-down base images, which don't include all the system packages that were previously installed (Git is amongst them).

    See also The Dockerfile which gives some details of the way the Dockerfile is used in Divio Projects.