Cannot install package from github package registry

I have an npm package uploaded to a organisation repo. Let’s call my org Org; the repo is kafka-client. (the first letter of my Org is uppercased)

I have two sets of errors:

  1. When I change the org scope (@OWNER) to @Org (first letter upcased) as per the documentation: working with NPM registry; I get the following error:

.npmrc

npm.pkg.github.com/:_authToken=${NPM_TOKEN}
@Orgname:registry=https://npm.pkg.github.org

error trace:

npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@org%2fkafka-client - Not found
npm ERR! 404
npm ERR! 404  '@org/kafka-client@0.0.1' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

Not sure know why it looks up registry.npmjs.org registry as opposed to npm.pkg.github.org; assuming it could not find the package there.

Whats weird is when I switch the case of the org to lowercase I get a whole different error:
.npmrc

npm.pkg.github.com/:_authToken=${NPM_TOKEN}
@orgname:registry=https://npm.pkg.github.org

error trace:

npm ERR! code ENOTFOUND
npm ERR! syscall getaddrinfo
npm ERR! errno ENOTFOUND
npm ERR! network request to https://npm.pkg.github.org/@org%2fkafka-client failed, reason: getaddrinfo ENOTFOUND npm.pkg.github.org
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

The package is there in the repo; From these logs I don’t know how to proceed. Anyone know what could be wrong?

I have no proxy / http_proxy settings configured for npm

The first thing I notice is your .npmrc is set up for @Orgname but the logs you’re showing are @org/kafka-client. Can you confirm that you’re installing @Orgname/kafka-client.

The npm cli will speak to the default registry registry.npmjs.com when it doesn’t find a matching scope that is set to an alternate registry.

The second issue is because the URL you should be using is npm.pkg.github.com — using .org will definitely fail with the message you’ve got because that domain name doesn’t exist :slight_smile:

1 Like

Thank you for pointing this out. I’m obviously blind; and not very smart.