If you want to be able to publish npm packages to a local npm registry so that they can be used and tested,
either before publishing them to a remote one or because npm link or even yalc are not working for you or if
you just need a really easy to use and install private npm registry, in this quick tips episode, you will
learn how. Above is the vid and below you will find some useful notes.
- 1.
Pre-reqs
-
Have node.js installed
-
Have Docker installed
-
- 2.
Using Verdaccio as a local Private NPM registry
-
Download Verdaccio’s image
Start the containerdocker pull verdaccio/verdaccio
Open the server in the browser http://localhost:4873/docker run -it --rm --name verdaccio -p 4873:4873 verdaccio/verdaccio
-
Add the user into Verdaccio:
For publishing a package into Verdaccio use:npm adduser --registry http://localhost:4873
npm publish --registry http://localhost:4873
-
For downloading the nodejs library, either, create a '.npmrc' at the root of your nodejs application:
Or set the new private registry globally:registry=http://localhost:4873/
npm set registry http://localhost:4873/
-
After that, as always use npm or yarn to install the package:
npm install LIBRARY-NAME
-
- 3.
Comentarios
Publicar un comentario