Skip to content

[BUG] Fails to install npm packages from private github repos in docker since v6.11.0 #950

@simonkotwicz

Description

@simonkotwicz

What / Why / When

npm fails to install npm packages from private github repositories in docker since v6.11.0

Where

packages from private github repositories in docker

How

Current Behavior

npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t https://github.com/user/private-repo
npm ERR!
npm ERR! remote: Password authentication is not available for Git operations.
npm ERR! remote: You must use a personal access token or SSH key.
npm ERR! remote: See https://github.com/settings/tokens or https://github.com/settings/ssh
npm ERR! fatal: unable to access 'https://github.com/user/private-repo': The requested URL returned error: 403
npm ERR!
npm ERR! exited with error code: 128

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-02-19T02_07_01_401Z-debug.log

Steps to Reproduce

  1. Install an npm package from a private git repository you have access to (eg. npm i git+https://github.com/user/private-repo)

  2. Write up a simple docker file like...

FROM node:12.16.0-alpine

WORKDIR /home/node

ARG GITHUB_READ_TOKEN
ARG NPM_VERSION

COPY package.json package-lock.json ./

RUN npm install -g npm@$NPM_VERSION && \
    apk add --no-cache --virtual temp-build-deps git && \
    echo -e "machine github.com\n  login $GITHUB_READ_TOKEN" > ~/.netrc && \
    npm install && \
    apk del temp-build-deps && \
    rm ~/.netrc

COPY . .

ENTRYPOINT ["npm", "test"]

run docker build . --build-arg NPM_VERSION=6.13.6 --build-arg GITHUB_READ_TOKEN=***

Expected Behavior

docker build succeeds like it does for docker build . --build-arg NPM_VERSION=6.10.0 --build-arg GITHUB_READ_TOKEN=***

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingRelease 6.xwork is associated with a specific npm 6 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions