Skip to content

NPM

This repository is used for storing npm packages.

Use npm scope to work with a private repository. For private user repository, the scope is @UID, for team access the scope is @TEAM_NAME-team.

Note

In command examples replace $LOC with the currently selected ICDC location.

npm login

Use npm login to authenticate with private repository and store credentials permanently in npm UserConfig* file:~/.npmrc`

npm login --repository=https://artifactory.$LOC.icdc.io/repository/npm-hosted --scope=@YOUR-SCOPE --always-auth
Username: your-uid
Password: ****
Email: your-uid@your-domain.com 

npm config set @YOUR-SCOPE:registry https://artifactory.$LOC.icdc.io/repository/npm-hosted

Note

If you authenticate in Artifactory with corporate (LDAP) login then you usually use an email-like username (e.g. john@doe.com). Standard npm login command does not allow the use of such username, because it is url-unsafe, so use the customized command to login:

# Download custom npm-login:
curl https://help.icdc.io/artifactory/npm-login -o npm-login && chmod +x npm-login
# Use npm-login to login with email-like username
./npm-login --registry=artifactory.$LOC.icdc.io --scope=@YOUR-SCOPE
Username: your-uid@your-domain.com 
Password: ****
Email (your-uid@your-domain.com): 

npm publish

Use npm scope to publish the package in your namespace. Add your scope name into package.json:

"name": "@YOUR-SCOPE/project-name"

Then npm publish to upload package into repository:

npm publish

npm install

To install some package from your private repository specify your scope:

npm install @YOUR-SCOPE/package@version