当前位置:   article > 正文

(笔记)RequestError: Hostname/IP does not match certificate‘s altnames: Host: npm.taobao.org.解决方法

(笔记)RequestError: Hostname/IP does not match certificate‘s altnames: Host: npm.taobao.org.解决方法
  1. (base) ➜ camera-app pnpm install --save-dev electron
  2. Packages: +75
  3. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  4. Progress: resolved 75, reused 75, downloaded 0, added 0, done
  5. node_modules/.pnpm/electron@31.0.0/node_modules/electron: Running postinstall script, failed in 422ms
  6. .../node_modules/electron postinstall$ node install.js
  7. │ RequestError: Hostname/IP does not match certificate's altnames: Host: npm.taobao.org. is not in the cert's altnames: DNS:*.tbcdn.cn, DN…
  8. │ at ClientRequest.<anonymous> (/Users/simley/ElectronProjects/camera-app/node_modules/.pnpm/got@11.8.6/node_modules/got/dist/source/c…
  9. │ at Object.onceWrapper (node:events:634:26)
  10. │ at ClientRequest.emit (node:events:531:35)
  11. │ at origin.emit (/Users/simley/ElectronProjects/camera-app/node_modules/.pnpm/@szmarczak+http-timer@4.0.6/node_modules/@szmarczak/htt…
  12. │ at TLSSocket.socketErrorListener (node:_http_client:500:9)
  13. │ at TLSSocket.emit (node:events:519:28)
  14. │ at emitErrorNT (node:internal/streams/destroy:169:8)
  15. │ at emitErrorCloseNT (node:internal/streams/destroy:128:3)
  16. │ at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
  17. │ at Object.checkServerIdentity (node:tls:337:12)
  18. │ at TLSSocket.onConnectSecure (node:_tls_wrap:1684:27)
  19. │ at TLSSocket.emit (node:events:519:28)
  20. │ at TLSSocket._finishInit (node:_tls_wrap:1085:8)
  21. │ at ssl.onhandshakedone (node:_tls_wrap:871:12)
  22. └─ Failed in 423ms at /Users/simley/ElectronProjects/camera-app/node_modules/.pnpm/electron@31.0.0/node_modules/electron
  23.  ELIFECYCLE  Command failed with exit code 1.

输入了下面的命令来修改electron_mirror,但是没生效

pnpm config set electron_mirror https://npmmirror.com/mirrors/electron/

然后输入`npm config set electron_mirror https://npmmirror.com/mirrors/electron/`

  1. (base) ➜ camera-app npm config set electron_mirror https://npmmirror.com/mirrors/electron/
  2. npm ERR! `electron_mirror` is not a valid npm option
  3. npm ERR! A complete log of this run can be found in: /Users/simley/.npm/_logs/2024-06-12T01_14_31_674Z-debug-0.log

但是报错了

最后输入`npm config ls`

找到npm的配置文件 /Users/simley/.npmrc

  1. (base) ➜ camera-app npm config ls
  2. ; "user" config from /Users/simley/.npmrc
  3. electron_mirror = "https://npm.taobao.org/mirrors/electron/"
  4. https-proxy = "http://127.0.0.1:7890/"
  5. proxy = "http://127.0.0.1:7890/"
  6. registry = "https://registry.npmmirror.com"
  7. strict-ssl = false

输入vim ~/.npmrc

最后将https://npm.taobao.org/mirrors/electron/ 改成 https://npmmirror.com/mirrors/electron/

  1. electron_mirror=https://npmmirror.com/mirrors/electron/
  2. https-proxy=http://127.0.0.1:7890/
  3. proxy=http://127.0.0.1:7890/
  4. registry=https://registry.npmmirror.com
  5. strict-ssl=false

:wq保存就OK了

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/天景科技苑/article/detail/848798
推荐阅读
相关标签
  

闽ICP备14008679号