Setting up npm
To do the setting up:
-
For all projects: run this command:
npm config set registry https://registry.yandexcloud.net/npm/<registry_ID> -
For one project:
-
Open the
.npmrcfile in the project root. -
Depending on the authentication method:
IAM token (Base64)IAM_tokenOAuth token (Base64)API key (Base64)-
Get an IAM token for the Yandex account or service account you are going to use for authentication.
-
Create the
NPM_AUTHenvironment variable:export NPM_AUTH=$(echo -n 'iam:<IAM_token>' | base64)Where
NPM_AUTHis the body of the previously obtained IAM token, Base64 -encoded. -
Add the following lines to the previously created
.npmrcfile:registry=https://registry.yandexcloud.net/npm/<registry_ID> //registry.yandexcloud.net/npm/:_auth=${NPM_AUTH} always-auth=true
-
Get an IAM token for the Yandex account or service account you are going to use for authentication.
-
Create the
NPM_AUTHenvironment variable:export NPM_AUTH="<IAM_token>"Where
NPM_AUTHis the body of the previously obtained IAM token. -
Add the following lines to the previously created
.npmrcfile:registry=https://registry.yandexcloud.net/npm/<registry_ID> //registry.yandexcloud.net/npm/:_authToken=${NPM_AUTH} always-auth=true
-
Get
an OAuth token for the Yandex account you are going to use for authentication. -
Create the
NPM_AUTHenvironment variable:export NPM_AUTH=$(echo -n 'oauth:<OAuth_token>' | base64)Where
NPM_AUTHis the body of the previously obtained OAuth token, Base64 -encoded. -
Add the following lines to the previously created
.npmrcfile:registry=https://registry.yandexcloud.net/npm/<registry_ID> //registry.yandexcloud.net/npm/:_auth=${NPM_AUTH} always-auth=true
-
Create an API key for the service account you are going to use for authentication.
-
Create the
NPM_AUTHenvironment variable:export NPM_AUTH=$(echo -n 'api_key:<API_key>' | base64)Where
NPM_AUTHis the body of the previously created API key, Base64 -encoded. -
Add the following lines to the previously created
.npmrcfile:registry=https://registry.yandexcloud.net/npm/<registry_ID> //registry.yandexcloud.net/npm/:_auth=${NPM_AUTH} always-auth=true
-
-