GItHub Packages + npm

I’m trying to migrate from our private npm server that uses verdaccio to using GitHub Packages in our private organization.

I’ve gathered that I need to set my package name in package.json to @myorg/my-package. However, I’m running into a roadblock with this. My organization’s name is CamelCase (e.g. MyOrganization instead of myorganization or my-organization). It seems that npm really doesn’t like that:

(note that my org isn’t actually called “MyOrganization”; I changed the name in this post for privacy purposes)

npm publish dist --verbose --registry "https://npm.pkg.github.com"

npm ERR! code E404
npm ERR! 404 Not Found - PUT https://npm.pkg.github.com/@MyOrganization%2fmy-package - The expected resource was not found.
npm ERR! 404
npm ERR! 404  '@MyOrganization/my-package@3.20.0' is not in the npm registry.
npm ERR! 404 Your package name is not valid, because
npm ERR! 404  1. name can no longer contain capital letters

I tried changing it to lowercase in package.json, but this didn’t work either.

npm ERR! code E404
npm ERR! 404 Not Found - PUT https://npm.pkg.github.com/@myorganization%2fmy-package - The expected resource was not found.
npm ERR! 404
npm ERR! 404  '@myorganization/my-package@3.20.0' 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

I seem to be at an impasse. Do I need to create another private organization that has a lowercase name to get around this?

For those having the same problem, I discovered that the lowercase “@myorganization” is actually the correct way to do this, but it wasn’t working for me due to a problem in my .npmrc.

2 Likes

:+1: Awesome, glad you were able to get it working.

1 Like