Netlify can't install github private repo as npm depencency

Hi there,
i am trying to deploy my first site with netlify.
So i have in my package.json some github private repository as a dependency like this:
"yp-designsystem": "git+https://<Personal Access Token>:x-oauth-basic@github.com/ORGANIZATION/yp-designsystem.git"
My PAT has acces to the repository. But when i deploy, it always fails with an error as show below.
Am i missing something?
Site name: yp-frontend-staging.netlify.app

Log:

3:33:43 PM: Installing NPM modules using NPM version 8.3.1
3:33:53 PM: npm ERR! code 128
3:33:53 PM: npm ERR! An unknown git error occurred
3:33:53 PM: npm ERR! command git --no-replace-objects ls-remote https://git@github.com/ORGANIZATION/yp-designsystem.git
3:33:53 PM: npm ERR! remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
3:33:53 PM: npm ERR! remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
3:33:53 PM: npm ERR! fatal: Authentication failed for 'https://github.com/ORGANIZATION/yp-designsystem.git/'
3:33:53 PM: npm ERR! A complete log of this run can be found in:
3:33:53 PM: npm ERR!     /opt/buildhome/.npm/_logs/2022-02-15T14_33_43_915Z-debug-0.log
3:33:53 PM: Error during NPM install
3:33:53 PM: Build was terminated: Build script returned non-zero exit code: 1

Hi @bunyaminyilmaz

Have you looked at this support guide on using private NPM modules?

those are served from npmjs.org
mine are github repositories.

Apologies. How about this support guide

1 Like

thank you very much.

If you think that could work, there are a couple of ways to get that info into our build environment:

  1. If your dependency manager (this works with npm at least) supports it, and your package.json is securely stored, you can add that dependency using a GitHub or GitLab access token like this: git+https://<github_token>:x-oauth-basic@github.com/<user>/<repo>.git (GitLab also documents this ). If you use BitBucket, you can to use an app password in the same way . Note that you can instead choose to not save the token to git, but use it directly from the command line during build if you keep that dependency out of your main package.json and instead set an environment variable like $GIT_TOKEN in the Build & Deploy settings for a site, and using a step in your build process like: npm install git+https://${GIT_TOKEN}:x-oauth-basic@github.com/user/repo.git

As written in my post if have tried this. But it does not work for me

Which pricing tier are you on @bunyaminyilmaz?

As mentioned in this post the ability to deploy from private organisation repositories is only available on Pro and up. It is likely this also applies to module dependencies too.

I have the Pro subscription.

Hey there, @bunyaminyilmaz :wave: can you please share you Netlify team name? I am not seeing an account associated with the email addressed you are using in the Forums. Thanks!