How to use public npm github package?

Viewed 140

sorry for a very newbie question to github packages.

I have setup a public utils library monorepo using lerna+ts+github actions at https://github.com/kristijorgji/winstonjs-utils

The ci so far seems to work (need to check package contents etc later)

the workflow says

lerna success published 3 packages
 - @kristijorgji/winstonjs-fingers-crossed-transport@1.0.1-beta.0
 - @kristijorgji/winstonjs-html-format@1.0.1-beta.0
 - @kristijorgji/winstonjs-mail-transport@1.0.1-beta.0

And I can also see 3 packages mentioned under my repository.

My problem now is that when I try to use this package, I cannot install it in client project

using npm I get asked for a password... Why do I need a password when I want(have already published) a public package ? I can install all other public packages just fine.

 npm install  @kristijorgji/winstonjs-fingers-crossed-transport@1.0.1-beta.0
npm ERR! code E401
npm ERR! Incorrect or missing password.
npm ERR! If you were trying to login, change your password, create an
npm ERR! authentication token or enable two-factor authentication then
npm ERR! that means you likely typed your password in incorrectly.
npm ERR! Please try again, or recover your password at:
npm ERR!     https://www.npmjs.com/forgot

using yarn get other error

yarn add v1.22.17
[1/4]   Resolving packages...
error Couldn't find package "@kristijorgji/winstonjs-fingers-crossed-transport" on the "npm" registry.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

I have even set access: public in every package.json

  "publishConfig": {
    "access": "public",
    "@kristijorgji:registry": "https://npm.pkg.github.com/kristijorgji"
  },

Update: I can install the package with npm only after creating a .npmrc file in config and setting my personal token there .npmrc

@kristijorgji:registry=https://npm.pkg.github.com/kristijorgji
always-auth=true
//npm.pkg.github.com/:_authToken=atokenwithreadpackagepermissionicreatedindevsettings

then npm install @kristijorgji/winstonjs-fingers-crossed-transport@1.0.1-beta.0 works fine

This is clearly not what I want to achieve with a PUBLIC package/libary/repository

Everyone should be able to install like a normal public npm package without needing access token. Please help me with information how to achieve that

Update: I stopped using github packages and used npm public registry instead. Working great so far and published packages normally at example https://www.npmjs.com/package/winstonjs-fingers-crossed-transport

0 Answers
Related