Skip to content

Can't fetch private dependency from github registry #188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
alex-trofimov opened this issue Aug 22, 2020 · 4 comments
Closed

Can't fetch private dependency from github registry #188

alex-trofimov opened this issue Aug 22, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@alex-trofimov
Copy link

Hi!
I have a dependency in my project that looks like this:
"react-native-background-geolocation-android": "git+https://github.com/transistorsoft/react-native-background-geolocation-android.git#3.8.0",

And this basic workflow:

name: Test

on:
  release:
    types:
      - created

jobs:
  release_codepush_update:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - name: Use Node.js
      uses: actions/setup-node@v1
      with:
        node-version: '12.x'
        always-auth: true
        registry-url: https://npm.pkg.github.com
        scope: '@transistorsoft'

    - name: Install dependencies
      run: npm install
      env:
        NODE_AUTH_TOKEN: ${{secrets.GH_ACCESS_TOKEN}}

Which throws this error on npm install step:

npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t https://github.com/transistorsoft/react-native-background-geolocation-android.git
npm ERR! 
npm ERR! remote: Repository not found.
npm ERR! fatal: repository 'https://github.com/transistorsoft/react-native-background-geolocation-android.git/' not found
npm ERR! 
npm ERR! exited with error code: 128

(My project isn't a part of the transistorsoft scope if that matters)

The access token is correct, I can fetch the dependency repo in the same workflow using curl.

Another part of the project's workflow is run on Appcenter and the same task of authentication is resolved by this bash script:

echo "always-auth=true
//npm.pkg.github.com/:_authToken=${GITHUB_ACCESS_TOKEN}" >> .npmrc

I tried replacing the content of .npmrc generated by this action with content generated by the said script but for some reason, I can't make it to work.

Any ideas what I'm doing wrong?

@alex-trofimov
Copy link
Author

alex-trofimov commented Aug 28, 2020

Switched to ssh as a workaround. Still would be nicer to use the token auth.

@Nestoro
Copy link

Nestoro commented Aug 2, 2021

i am experiencing a the same problematic using:

"mypackage": "https://[username]:[token]@github.com/[organization]/[package].git#[tag]",

npm ERR! fatal: repository 'https://github.com/[organization]/[package].git/' not found

locally everything works fine.

@dmitry-shibanov dmitry-shibanov added the bug Something isn't working label Dec 13, 2021
@dmitry-shibanov
Copy link
Contributor

Hello everyone. Thank you for your report. As I know you can not configure the .npmrc file to install private/public repository as dependency. It's made from the package.json file.
For now I'm closing the issue, because it's not related to the setup-node action. If I'm wrong about configuring the .npmrc file could you please ping us and attach link to the documentation.

@Nestoro
Copy link

Nestoro commented Dec 22, 2021

regardless of the lack of configuration options in .npmrc regarding auth; the example i added is using a source url which is including all credentials in itself inside the package.json file.
the error is not that the auth is insufficient. rather that the repo is not found. and my example works everywhere except the setup-node environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants