Инструменты пользователя

Инструменты сайта


service:nodejs

Настройка сборки

На примере Teamcity

# Частный репозиторий
npm config set registry="https://nexus-ci.example.com/repository/project-npm/"
npm config set //nexus-ci.example.com/repository/project-npm/:username=%nexus_username%
npm config set //nexus-ci.example.com/repository/project-npm/:_password=%nexus_password%
# Игнор кривого SSL-сертификата
npm config set strict-ssl false
# Скачать зависимости
npm install --verbose

https://docs.npmjs.com/cli/v11/configuring-npm/npmrc#auth-related-configuration

Ошибки

Self-signed certificate in certificate chain

Сборка надолго зависает и заканчивается ошибкой, зависимости не скачиваются, в логах ругань на кривой SSL-сертификат. Решение (при отсутствии более правильного)

npm config set strict-ssl false

https://stackoverflow.com/questions/9626990/receiving-error-error-ssl-error-self-signed-cert-in-chain-while-using-npm

Unable to authenticate, need: BASIC realm="Sonatype Nexus Repository Manager"

Невозможно скачать модули из Нексуса, ошибка HTTP 401.

npm ERR! code E401
npm ERR! Unable to authenticate, need: BASIC realm="Sonatype Nexus Repository Manager"

Решение: поменять username и _password на _auth.

repo='nexus.example.com/repository/project-npm'
npmbin='%teamcity.tool.node-20.14.0%/bin/npm'
# Get modules
$npmbin config set registry="https://$repo/"
$npmbin config set //$repo/:_auth=$(echo -n "%nexus_username%:%nexus_password%" |base64)
$npmbin config set strict-ssl false
$npmbin install --verbose
service/nodejs.txt · Последнее изменение: viacheslav

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki