loading...

npm vs Github Packages

nishantwrp profile image Nishant Mittal ・1 min read

What is the main difference between when I publish using official npm registry service and when I publish using github packages. Which should I go for?

Discussion

pic
Editor guide
Collapse
patarapolw profile image
Pacharapol Withayasakpunt

GitHub packages doesn't support yarn.

Also, if you even need to publish private package, Verdaccio + Docker / Ngrok / Cloud is an option.

Collapse
evertp profile image
Evert Pot

Yarn supports alternative package registries. Are you sure this is the case?

Collapse
patarapolw profile image
Pacharapol Withayasakpunt

I have tried sometime ago, but it is just my experience.

Thread Thread
evertp profile image
Evert Pot

Makes sense. Maybe you ran into an issue but it's definitely supported in Yarn

Collapse
nishantwrp profile image
Collapse
Sloan, the sloth mascot
Comment deleted
Collapse
mahalde profile image
mahalde

Sorry, I don't know much about GitHub packages, but it is possible to reference a GitHub repo in the dependencies in package.json. (source)

Collapse
utkal97 profile image
Utkal

Ohh I didn't know this. So, my argument of "inability of listing in dependencies" is invalid then. Thanks for sharing, I have learnt a new thing today.

Thread Thread
nishantwrp profile image
Nishant Mittal Author

Also I think, we can do npm install with github packages.

Thread Thread
utkal97 profile image
Utkal

Hey I just checked up, it seems that we can give the github repository link to npm install command and install the package. I am considering deleting my reply to the article since it is misleading. Thank you Mahalde and Nishant. I have learnt two new things today.

Collapse
talk2megooseman profile image
Erik Guzman

Unless they change things recently, if you want to publish a public npm package, you cant do this with Github Packages. Just use the npm registry anyway, it is owned by Github and should see some good integrations in the future hopefully.

Collapse
webeleon profile image
Webeleon

Microsoft bought github
GitHub bought npm

Atm that's just 2 different package registry you can choose.

I'm betting it will be merged in a close future