Setup of npm package storage – In this tutorial you will learn:
1.How to install npm on ubuntu
2.Basic usage commands for npm and storage using Nexus Sonatype
Prerequisites
Before you begin, you will need the following requirements:
- An Ubuntu 22.04 server.
- A non-root user with sudo/administrator enabled.
- A domain name pointed to your Ubuntu server IP address (For production)
- Have a proper internet connection
- Have a proper setup of Sonatype-nexus server
Before installing any package, run the apt command below to
update and refresh your repositories package index.
$sudo apt update
To install npm on Ubuntu
$ sudo apt install npm
OR
$ sudo apt install npm nodejs
Basic usage commands for npm
Here’s a list of the various npm commands you’ll likely need to know:
To see the version of npm and verify it’s installed on the system:
$ npm –version
$ node –version
Once it installed successfully.. You can use below steps for publishing npm packages on nexus server
>Most important thing make sure you have to done set your ip address first. Using if config , ip address , or ip a commands
Lets get start it Actual sonatype nexus setup for npm storage
1. How to create your own npm repository on Sonatype-Nexus server
Open Your Sonatype-Nexus Server using your ip and port And login into it
Open repository menu and click on create repository. You need to create your own npm repositoy for publishing your npm-packages..
click on npm(hosted)
Using below reference create your npm repository
And click on create repository at last…
Once is done open realms menu on Sonatype-nexus Server transfer your npm Bearer Token Realm to right side
And click on save button
once you create your own repository copy your repo url for log in purpose..
Open your Terminal (ctrl + alt + T)
First you need to set your proxy setting… use below steps for do it.
npm config set proxy http://(Your ip and port) npm config set https-proxy http://(Your ip and port) npm config set registry (your-nexus-url-paste-here) npm login
npm notice Log in on your-nexus-url
Username: Your-nexus-username
Password: Your-nexus-password
Email: (this IS public) (Your-email-address)
Logged in as Your-nexus-username on your-nexus-url
If You have followed above steops as one by one you will get success to login npm repository
If is it done then please do belove steps for exploring to it..
Then you need to create git repository.. and git clone in to it
$ git clone https://Your-git-repository
once it create and cloned successfully … need to set your credentials into it
I have cloned my repository successfully.. and varified it.
$cd npm-registry-couchapp
$npm publish
Varify it using your created repositoy on Sonatype-Nexus server
Hope you like this blog….
- Deployment of vault HA using MySQL - September 18, 2024
- Sending slack notification via pipeline job - August 25, 2024
- SonarQube integration with Jenkins - August 24, 2024