Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not Found - PUT https://npm.pkg.github.com/package-name

I'm trying to upload a package on GPR (Github Package registry). I log in successfully:

npm login --registry=https://npm.pkg.github.com

and then run these command:

npm set registry https://npm.pkg.github.com/

npm publish

which returns this error:

npm ERR! 404 Not Found - PUT https://npm.pkg.github.com/package-name
npm ERR! 404 
npm ERR! 404  'package-name@version' is not in the npm registry.

Seems it tries to upload a package on npm registry instead of github package registry. How should I fix this problem?

like image 321
kaxi1993 Avatar asked Sep 14 '19 19:09

kaxi1993


People also ask

What is GitHub package?

GitHub Packages is a platform for hosting and managing packages, including containers and other dependencies. GitHub Packages combines your source code and packages in one place to provide integrated permissions management and billing, so you can centralize your software development on GitHub.


Video Answer


1 Answers

There are two ways to solve this problem:

  1. Specify publishConfig option in package.json:
"publishConfig": {
    "registry":"https://npm.pkg.github.com/@OWNER"
},
  1. Add .npmrc file to your project with this content:
registry=https://npm.pkg.github.com/@OWNER

replacing OWNER with the name of the user or organization account on GitHub that owns the repository where you will publish the package.

like image 101
kaxi1993 Avatar answered Sep 21 '22 02:09

kaxi1993