How do I access a private github repo when deploying

I’m trying to use a private github repo as a dependency in my package.json. I don’t want my access token saved in the package.json so I want to use an environment variable like is briefly mentioned here https://docs.netlify.com/configure-builds/repo-permissions-linking/#npm-packages

I’ve set up a github personal access token with read access as described here [Common Issue] How do I access private repositories in the build environment?

and I’ve added it to my Build & Deploy Environment variables but I can’t seem to get it to access the env var in the package.json. Any help would be greatly appreciated.

hi there, welcome. hmm, do you have a build error or something else that you can show us? what happens when you try and access the env?