首页 前端知识 (笔记)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.解决方法

2024-07-02 23:07:13 前端知识 前端哥 509 444 我要收藏
(base) ➜  camera-app pnpm install --save-dev electron


Packages: +75
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 75, reused 75, downloaded 0, added 0, done
node_modules/.pnpm/electron@31.0.0/node_modules/electron: Running postinstall script, failed in 422ms
.../node_modules/electron postinstall$ node install.js
│ RequestError: Hostname/IP does not match certificate's altnames: Host: npm.taobao.org. is not in the cert's altnames: DNS:*.tbcdn.cn, DN…
│     at ClientRequest.<anonymous> (/Users/simley/ElectronProjects/camera-app/node_modules/.pnpm/got@11.8.6/node_modules/got/dist/source/c…
│     at Object.onceWrapper (node:events:634:26)
│     at ClientRequest.emit (node:events:531:35)
│     at origin.emit (/Users/simley/ElectronProjects/camera-app/node_modules/.pnpm/@szmarczak+http-timer@4.0.6/node_modules/@szmarczak/htt…
│     at TLSSocket.socketErrorListener (node:_http_client:500:9)
│     at TLSSocket.emit (node:events:519:28)
│     at emitErrorNT (node:internal/streams/destroy:169:8)
│     at emitErrorCloseNT (node:internal/streams/destroy:128:3)
│     at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
│     at Object.checkServerIdentity (node:tls:337:12)
│     at TLSSocket.onConnectSecure (node:_tls_wrap:1684:27)
│     at TLSSocket.emit (node:events:519:28)
│     at TLSSocket._finishInit (node:_tls_wrap:1085:8)
│     at ssl.onhandshakedone (node:_tls_wrap:871:12)
└─ Failed in 423ms at /Users/simley/ElectronProjects/camera-app/node_modules/.pnpm/electron@31.0.0/node_modules/electron
 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/`

(base) ➜  camera-app npm config set electron_mirror https://npmmirror.com/mirrors/electron/
npm ERR! `electron_mirror` is not a valid npm option

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

(base) ➜  camera-app npm config ls

; "user" config from /Users/simley/.npmrc

electron_mirror = "https://npm.taobao.org/mirrors/electron/"
https-proxy = "http://127.0.0.1:7890/"
proxy = "http://127.0.0.1:7890/"
registry = "https://registry.npmmirror.com"
strict-ssl = false

输入vim ~/.npmrc

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

electron_mirror=https://npmmirror.com/mirrors/electron/
https-proxy=http://127.0.0.1:7890/
proxy=http://127.0.0.1:7890/
registry=https://registry.npmmirror.com
strict-ssl=false

:wq保存就OK了

转载请注明出处或者链接地址:https://www.qianduange.cn//article/13808.html
标签
pnpmelctron
评论
发布的文章

JQuery中的load()、$

2024-05-10 08:05:15

大家推荐的文章
会员中心 联系我 留言建议 回顶部
复制成功!