programing

npm 설치를 실행할 때 첫 번째 인증서를 확인할 수 없음

stoneblock 2023. 10. 31. 20:26

npm 설치를 실행할 때 첫 번째 인증서를 확인할 수 없음

https://github.com/angular/quickstart/blob/master/README.md 에서 Angular2 튜토리얼을 보고 있었습니다.

하지만 가이드대로 npm install을 실행하면 처음에 관련된 오류가 발생했습니다.UNABLE_TO_VERIFY_LEAF_SIGNATURE. 구글링에서 SSL cert와 관련이 있는 것 같아서 다음 명령을 사용하여 이 문제를 해결하려고 했습니다.

npm config set strict-ssl false

그 다음에 다시 시도했습니다.npm install

이것은 좀 더 발전했지만, "첫번째 인증서를 확인할 수 없음"과 관련된 새로운 오류가 발생했습니다.

typings ERR! message Unable to connect to "https://api.typings.org/entries/dt/core-js/tags/0.0.0%2B20160725163759"
typings ERR! caused by unable to verify the first certificate

typings ERR! cwd c:\Code\Angular2\Quickstart
typings ERR! system Windows_NT 6.1.7601
typings ERR! command "C:\\Program Files\\nodejs\\node.exe" "c:\\Code\\Angular2\\Quickstart\\node_modules\\typings\\dist\\bin.js" "install"
typings ERR! node -v v6.7.0
typings ERR! typings -v 1.4.0
typings ERR! code EUNAVAILABLE

typings ERR! If you need help, you may report this error at:
typings ERR!   <https://github.com/typings/typings/issues>

npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.14
npm WARN angular-quickstart@1.0.0 No license field.
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v6.7.0
npm ERR! npm  v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! angular-quickstart@1.0.0 postinstall: `typings install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular-quickstart@1.0.0 postinstall script 'typings install'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular-quickstart package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     typings install
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs angular-quickstart
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls angular-quickstart
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     c:\Code\Angular2\Quickstart\npm-debug.log

NodeJS와 Angular2 개발은 처음입니다.좋은 생각이 있으신가요? 혹시 제가 세부사항을 빠뜨린 것이 있다면 말씀해주세요.

레지스트리를 구성에서 http 버전으로 변경해 볼 수 있습니다.

npm config set registry http://registry.npmjs.org/ --global

저의 경우 .npmrc의 ca-file을 기업 프록시 인증서에 추가하는 것이 해결책이었습니다.

npm config set cafile "path to proxy cert file"

또는 .npmrc에서 편집기와 함께 삽입합니다.

cafile=<path to proxy cert file>

.npmrc 파일은 홈 디렉토리에 있습니다.

https://github.com/typings/typings/issues/564 의 지침을 사용하여 문제를 해결할 수 있었습니다.

이 문제는 궁극적으로 제 기계가 어떤 회사 프록시 뒤에 있는 것과 관련이 있는데, 이는 npm이 프록시를 상대로 https를 인증할 수 없는 것과 관련이 있는 것으로 보입니다.사용 중인 프록시에 대한 추가 정보가 없었기 때문에 위 @leetibbett 제안대로 구성할 수 없었습니다.그래서 http 버전을 사용하기 위해 루트 디렉터리에 .typingrc 파일을 만들었습니다.

{
     "rejectUnauthorized": false,
     "registryURL": "http://api.typings.org/"
}

Js 12 노드를 제거하고 버전 10을 다시 설치했습니다.그것으로 제 문제가 해결됐습니다.문제가 버전이었는지는 모르겠지만, 시도해 보셔도 됩니다.그것이 당신에게 도움이 되었기를 바랍니다.

환경변수 NODE_TLS_REJECT_UNANCERTIFED0으로 설정합니다.

언급URL : https://stackoverflow.com/questions/40000952/unable-to-verify-the-first-certificate-when-running-npm-install