Reputation: 2195
I'm trying to publish npm package to the GitHub package registry. Here is my package.json
file and .npmrc
file
package.json
{
"name": "@chathurabuddi/constants",
"version": "1.0.0",
"description": "All constants",
"main": "index.js",
"repository": {
"type": "git",
"url": "git://github.com/chathurabuddi/contants.git"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com"
},
"keywords": [
"chathurabuddi",
"constants"
],
"author": "chathurabuddi",
"homepage": "http://chathurabuddi.lk",
"license": "ISC"
}
.npmrc
chathurabuddi@registry=https://npm.pkg.github.com
But when I try to run npm publish
it gives me the following error.
C:\Users\CHATHURA\IdeaProjects\constants>npm publish
npm notice
npm notice package: @chathurabuddi/[email protected]
npm notice === Tarball Contents ===
npm notice 201B index.js
npm notice 437B package.json
npm notice 917B .github/workflows/npm-publish.yml
npm notice === Tarball Details ===
npm notice name: @chathurabuddi/constants
npm notice version: 1.0.0
npm notice package size: 889 B
npm notice unpacked size: 1.6 kB
npm notice shasum: bf9cefa335b89aa1bd3950a7f7d953259f891f40
npm notice integrity: sha512-n1GLzxFtEaklV[...]d5u0bMDQXVHiQ==
npm notice total files: 3
npm notice
npm ERR! code E404
npm ERR! 404 Not Found - PUT https://npm.pkg.github.com/@chathurabuddi%2fconstants - The expected resource was not found.
npm ERR! 404
npm ERR! 404 '@chathurabuddi/[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.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\CHATHURA\AppData\Roaming\npm-cache\_logs\2021-06-27T02_58_58_228Z-debug.log
Note that I already signed in to npm by running npm login -registry=https://npm.pkg.github.com
. The Personal Access Token used to log in includes all permissions required, repo
, package:read
and package:write
.
I already tried several solutions suggested in several posts and none of them worked.
Does anyone know what is the exact problem with this issue?
Upvotes: 2
Views: 2356
Reputation: 108
It seems like you misspelled the repository URL.
"url": "git://github.com/chathurabuddi/contants.git"
should be changed to
"url": "git://github.com/chathurabuddi/constants.git"
in the package.json
.
Upvotes: 3