Can't push a package to Github

706 views Asked by At

I'm trying setup Github Packages for a NPM project but I'm running into some issues..

I have a repo under a specific org: my-orgname/my-repo-name This repo is private

The code in themy-orgname/my-repo-name repo contains a NPM module.

package.json in project

{
  "name": "@my-orgname/my-repo-name",
  "version": "1.0.0",
  "description": ".....",
  "publishConfig": {
    "registry": "https://npm.pkg.github.com/"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/my-orgname/my-repo-name"
  },
  .....

.npmrc in project folder registry=https://npm.pkg.github.com/my-orgname

~/.npmrc file

//registry.npmjs.org/:_authToken=<TOKEN>
//npm.pkg.github.com/:_authToken=<TOKEN>

From within the project folder.. npm publish

Results In

npm ERR! 404 Not Found - PUT https://npm.pkg.github.com/@my-orgname%2fmy-repo-name - The expected resource was not found.
npm ERR! 404 
npm ERR! 404  '@my-orgname/[email protected]' 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.
1

There are 1 answers

0
Beevik On

I had a similar problem and found that I needed to give my github personal access token the following permissions:

  • repo (Full control of private repositories)
  • write:packages (Upload packages to github package registry)
  • read:packages (Download packages from github package registry)