회사 컴퓨터나 집이 아닌 외부 환경에서 npm 사용 시 에러 발생 문제

C:\\Users\\Administrator\\programming>npm install -g create-react-app
npm ERR! code UNABLE_TO_VERIFY_LEAF_SIGNATURE
npm ERR! errno UNABLE_TO_VERIFY_LEAF_SIGNATURE
npm ERR! request to <https://registry.npmjs.org/create-react-app> failed, reason: unable to verify the first certificate

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\\Users\\Administrator\\AppData\\Roaming\\npm-cache\\_logs\\2021-12-31T08_04_56_496Z-debug.log

이 문제는 해당 사이트에서 보낸 인증서가 아닌 회사 인증서가 npm 을 사용하는 컴퓨터로 전송되어 발생하는 에러라고 합니다. 사내 보안을 위하여 사용하는 프록시 서버가 이를 유발한다고 하네요. 아래와 같은 이유가 원인이라고 합니다.

해당 패키지 매니져가 요청하는 호스트[ex) pypi.python.org]에 대한 인증서가 패키지 매니져에 등록되어 있거나해당 URL을 무조건 신뢰하겠다는 옵션을 설정하거나strict-ssl 설정을 false로 하여 해결하거나https로 통신하는 게 아닌 http로 통신

출처 : 새로비 님의 블로그

저의 경우는 아래의 명령어를 통하여 간단하게 해결했습니다.

npm config set strict-ssl false


npm ERR! code E404
npm ERR! 404 Not Found - GET <https://registry.npmjs.org/@next%2fbundle-an.lyzer> - Not found
npm ERR! 404
npm ERR! 404  '@next/bundle-an.lyzer@^14.0.4' is not in this registry.
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in: C:\\Users\\jm91\\AppData\\Local\\npm-cache\\_logs\\2024-04-23T00_09_09_532Z-debug-0.log