Before you publish npm library to nexus or npm registry you can try it out locally.
Hope you already know how to link your library with your project locally and do the development. However, if you don’t know, please follow the below two steps to test your library locally linked with your app without installing it from a remote registry.
// step 1: To publish library locally & use it in applcation
npm run build
npm link// step 2: To install npm library which is pulished in locallycd path-to-your-applicaiton/your-applicaiton
npm link secure-react-keycloak
npm run start
Let’s jump into the publishing part
When I tried out the following command to publish my npm library according to guidelines.
npm login --registry=https://nexus.cagline.lk/repository/npm/
after logging in with a username, password, email I tried out
but it gives an error,
Then tried out the following step and get things done.
Publish into nexus
npm publish --registry https://nexus.cagline.lk/repository/npm/
This command works like a charm.
Install the library into another project
Create a .npmrc file in the project root directory with the following lines
registry = https://nexus.cagline.lk/repository/npm/
registry = https://registry.npmjs.org/
Install the package
npm i -S secure-react-keycloak