LoginSignup
5
4

More than 3 years have passed since last update.

yarnで Error: self signed certificate in certificate chain と認証エラーが発生したら

Posted at

いつしか yarn global 系のコマンドで以下のエラーが出るようになっていた。

yarn Error: self signed certificate in certificate chain

内容としては、オレオレ証明書を許さないって感じな気がする。

yarn のconfigを確認しよう

yarn config list

で一覧を出しましょう。以下のようなものが出ます。

yarn config v1.15.2
info yarn config
{ 'version-tag-prefix':
   'v',
  'version-git-tag':
   true,
  'version-commit-hooks':
   true,
  'version-git-sign':
   false,
  'version-git-message':
   'v%s',
  'init-version':
   '1.0.0',
  'init-license':
   'MIT',
  'save-prefix':
   '^',
  'bin-links':
   true,
  'ignore-scripts':
   false,
  'ignore-optional':
   false,
  registry:
   'https://registry.yarnpkg.com',
  'strict-ssl':
   true,
  'user-agent':
   'yarn/1.15.2 npm/? node/v10.15.3 darwin x64',
  lastUpdateCheck:
   1570528586389 }

重要なのは 'strict-ssl': true, のところです。
ここが 'strict-ssl': true, だとオレオレ証明書に対して、この記事の取り扱っている対象のエラーが発生します。

証明書に関してのエラーを許可する

ということで、strictにならなくていいからさ、ということでconfigを上書きします。

yarn config set strict-ssl false

これで、 'strict-ssl': false, に変わります。

はい、解決しましたとさ。

5
4
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
4