2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

npx createでエラー、UNABLE_TO_GET_ISSUER_CERT_LOCALLYの対処メモ

Last updated at Posted at 2024-08-17

問題

npx create-next-app@latest でプロジェクトが作成できない。
エラー文は以下。

npm error code UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm error errno UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm error request to https://registry.npmjs.org/create-next-app failed, reason: unable to get local issuer certificate

環境

macOS sonoma 14.6.1

解決策

実行したこと。

1. npm の registry 設定

npm -g config set registry https://registry.npmjs.org/

設定は初回のみでOK。
URLは http://registry.npmjs.org/ との情報もある。

2. npm の SSL証明書の検証を無効にする設定

npm -g config set strict-ssl false

3. 失敗した npx create を再試行

npx create-next-app@latest my-next-project
...
...
...

Success! Created my-next-project at...

プロジェクト作成が成功したことを確認できた。

4. 検証設定を元に戻す

npm の SSL証明書の検証を有効に設定。

npm -g config set strict-ssl true

5. 設定の確認

npm config list

参考サイト

2
1
0

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
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?