Programing

SSL 오류 : npm 명령을 사용하는 동안 CERT_UNTRUSTED

crosscheck 2020. 6. 16. 08:20
반응형

SSL 오류 : npm 명령을 사용하는 동안 CERT_UNTRUSTED


npm 명령을 사용하여 Express 프레임 워크를 설치하려고하지만 다음 오류가 발생합니다.

오류 메시지는

E:\myFindings\nodejs_programs\node>npm install -g express
npm http GET https://registry.npmjs.org/express
npm ERR! Error: SSL Error: CERT_UNTRUSTED
npm ERR!     at ClientRequest.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\request\main.js:409:26)
npm ERR!     at ClientRequest.g (events.js:185:14)
npm ERR!     at ClientRequest.EventEmitter.emit (events.js:88:17)
npm ERR!     at HTTPParser.parserOnIncomingClient [as onIncoming] (http.js:1445:7)
npm ERR!     at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:111:23)
npm ERR!     at CleartextStream.socketOnData [as ondata] (http.js:1356:20)
npm ERR!     at CleartextStream.CryptoStream._push (tls.js:396:27)
npm ERR!     at SecurePair.cycle (tls.js:751:20)
npm ERR!     at EncryptedStream.CryptoStream.write (tls.js:131:13)
npm ERR!     at Socket.ondata (stream.js:38:26)
npm ERR!  [Error: SSL Error: CERT_UNTRUSTED]
npm ERR! You may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "express"
npm ERR! cwd E:\myFindings\nodejs_programs\node
npm ERR! node -v v0.8.0
npm ERR! npm -v 1.1.32
npm ERR! message SSL Error: CERT_UNTRUSTED
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     E:\myFindings\nodejs_programs\node\npm-debug.log
npm ERR! not ok code 0

정리하도록 도와주세요


아래 명령을 사용하여 https를 무시할 수 있습니다.

npm config set strict-ssl false

또는 아래와 같이 https 또는 http에서 레지스트리 URL을 설정하십시오.

npm config set registry="http://registry.npmjs.org/"

그러나 개인적으로 https를 우회하는 것이 실제 솔루션이 아니라고 생각하지만 해결 방법으로 사용할 수 있습니다.


npm ERR! node -v v0.8.0
npm ERR! npm -v 1.1.32

node.js 설치를 업데이트하십시오. 다음 명령을 수행하십시오 ( 여기에서 ).

sudo npm cache clean -f
sudo npm install -g n
sudo n stable

편집 : 당신이 경우 좋아, 정말 소프트웨어의 고대 버전을 실행하는 좋은 이유가, npm set ca null문제가 해결됩니다. 내장 된 npm 인증서가 수년에 걸쳐 만료 되었기 때문에 발생했습니다.


나는 같은 문제가 있었고 마침내 내 노드 버전이 오래되었다는 것을 알았습니다. 예를 들어 다음 단계에 따라 현재 활성 LTS 노드 버전을 Ubuntu에 설치할 수 있습니다.

sudo apt-get update
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install nodejs -y

더 많은 버전 및 시스템에 대한 설치 지시 사항은 다음 링크에서 찾을 수 있습니다.

https://github.com/nodesource/distributions/blob/master/README.md


위의 오류의 이유가 있다고 생각합니다. 클라이언트 네트워크에서 작동하기 위해 제공되는 회사 프록시 (가상 사설망)입니다. 그 연결이 없으면 자주 maven 빌드 또는 npm 설치와 같은 문제에 직면했습니다.


회사 프록시를 사용하는 경우 회사 프록시로 npm에 대해이 설정을 시도하십시오.

npm --https-proxy=http://proxy.company.com install express -g

Google을 통해 게시물을 우연히 발견 한 이후 :

npm ci그것을 사용해보십시오 npm install.

매뉴얼에서 :

간단히 말해 npm install과 npm ci 사용의 주요 차이점은 다음과 같습니다.

  • The project must have an existing package-lock.json or npm-shrinkwrap.json.
  • If dependencies in the package lock do not match those in package.json, npm ci will exit with an error, instead of updating the package lock.
  • npm ci can only install entire projects at a time: individual dependencies cannot be added with this command.
  • If a node_modules is already present, it will be automatically removed before npm ci begins its install.
  • It will never write to package.json or any of the package-locks: installs are essentially frozen.

참고URL : https://stackoverflow.com/questions/21855035/ssl-error-cert-untrusted-while-using-npm-command

반응형