気ままなタンス*プログラミングなどのノートブック

プログラミングやRPGツクール、DTM等について、学んだことや備忘録をアウトプットとして残し、情報を必要としている誰かにとって「かゆいところに手が届く」ブログとなることを願いながら記事を書いています。

【Node.js・Reactなど】Cannot read properties of nullやUNABLE_TO_GET_ISSUER_CERT_LOCALLYが発生した場合の対応方法

スポンサーリンク

  • npm installでエラーが発生した場合の対応方法についてメモします。

エラー内容

・Cannot read properties of null (reading 'pickAlgorithm') 
・failed, reason: unable to get local issuer certificate 
・npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY 
・npm ERR! errno UNABLE_TO_GET_ISSUER_CERT_LOCALLY 

対応方法

以下のコマンドを実行し、設定を追加する

$ npm -g config set registry https://registry.npmjs.org/ 
$ npm -g config set strict-ssl false

もし、以下のようなメッセージが表示された場合

npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

表示どおり、以下のコマンドで対応する

$ npm install --force

あるいは

$ npm install --legacy-peer-deps