3

I published a package via Github's package manager, and it seemed to work. It appears on the repo's web page and on my profile page. When I run

npm install @franklinharvey/time-remaining@1.0.0

locally it works, but when I try it in a new environment such as Replit or CodeSandbox it does not appear. It also does not appear on npmjs.com

Here are some config files

.npmrc

registry=https://npm.pkg.github.com/franklinharvey

.yarnrc

"@franklinharvey:time-remaining" "https://npm.pkg.github.com"

package.json (partial)

"name": "@franklinharvey/time-remaining",
"publishConfig": {
    "registry": "https://npm.pkg.github.com"
},
"repository": {
    "url": "git@github.com:franklinharvey/time-remaining.git"
}

.npmignore

.gitignore
src/
*.log
*.tsbuildinfo

package-lock.json
yarn.lock

coverage
node_modules
Frank
  • 735
  • 1
  • 12
  • 33

1 Answers1

0

Our company also publishes its npm packages via github. Your post gave me an idea, and it fixed the issue on our end.

In a nutshell, I think you need both a fuller .npmrc where you're trying to download the package and not succeeding (containing the registry info as below); as well as to do an npm login if your package is private.

My .npmrc:

@my-company-s-npm-account:registry=https://npm.pkg.github.com/
//npm.pkg.github.com/:_authToken=[GITHUB_AUTH_TOKEN_HERE_WITHOUT_BRACKETS]
registry=https://registry.npmjs.org/

Hope this fixes your issue.

If you can't add an .npmrc or do an npm login where you're trying to install it, and your package is private, I'm not sure how to help.

Tristan Duquesne
  • 512
  • 1
  • 6
  • 16