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

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


service:nodejs

Различия

Показаны различия между двумя версиями страницы.

Ссылка на это сравнение

Предыдущая версия справа и слеваПредыдущая версия
Следующая версия
Предыдущая версия
service:nodejs [13.03.2025 07:23] – [Self-signed certificate in certificate chain] viacheslavservice:nodejs [12.06.2025 07:29] (текущий) – [Self-signed certificate in certificate chain] viacheslav
Строка 1: Строка 1:
 +===== Настройка сборки =====
 +На примере Teamcity
 +<code bash>
 +# Частный репозиторий
 +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
 +</code>
 +https://docs.npmjs.com/cli/v11/configuring-npm/npmrc#auth-related-configuration
 +===== Ошибки =====
 +==== Self-signed certificate in certificate chain ====
 +Сборка надолго зависает и заканчивается ошибкой, зависимости не скачиваются, в логах ругань на кривой SSL-сертификат. Решение (при отсутствии более правильного)
 +<code bash>
 +npm config set strict-ssl false
 +</code>
 +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.
 +<code>
 +npm ERR! code E401
 +npm ERR! Unable to authenticate, need: BASIC realm="Sonatype Nexus Repository Manager"
 +</code>
 +
 +Решение: поменять ''username'' и ''_password'' на ''_auth''.
 +<code bash>
 +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
 +</code>

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki