Install package from private repository is failing with 404

I am trying to run an NPM install in my app that uses a private npm repository but it is failing and I get the following error:

[stderr] ERR! code E404
[stderr] npm ERR! 404 Not Found - GET http://10.4.1.2:4873/@myscope%2ftypes - no such package available
[stderr] npm ERR! 404 
[stderr] npm ERR! 404  '@myscope/types@1.23.0' is not in this registry.
[stderr] npm ERR! 404 
[stderr] npm ERR! 404 Note that you can also install from a
[stderr] npm ERR! 404 tarball, folder, http url, or git url.

Looks like eas is trying to get my package from it’s own npm cache 10.4.1.2:4873. Why is it not picking up my .npmrc?

This happens in EAS build but also from running a local build with npx eas build --local.

I have a .npmrc file in my local like so:

//npm.pkg.github.com/:_authToken=<my-token>
#always-auth=true
@myscope:registry=https://npm.pkg.github.com

My npm install script works fine so I know these credentials are correect.

In my CI in GitHub actions, I am creating the .npmrc fil in the root of my app. I assume this gets copied over to EAS when I run eas build?

I have followed Use private npm packages - Expo Documentation to setup private repository but still getting this error.

Why is EAS not picking up the correct npm repo url?

hi there,

In my CI in GitHub actions, I am creating the .npmrc fil in the root of my app. I assume this gets copied over to EAS when I run eas build?

this doc explains how projects are uploaded to EAS Build: https://expo.fyi/eas-build-archive - tl;dr: if it’s gitignored, it won’t get uploaded.

you can create the .npmrc file that points to your private registry in a preinstall hook, or check it in to git, or use .easignore (more info in the eas-build-archive link from above)