npm i 安装报错RequestError: socket hang up
1 异常信息
npm WARN deprecated @npmcli/move-file@2.0.1: This functionality has been moved to @npmcli/fs npm WARN deprecated asar@3.2.0: Please use @electron/asar moving forward. There is no API change, just a package name change npm ERR! code 1 npm ERR! path /Users/zhangjin/mycode/github/cursor/node_modules/electron npm ERR! command failed npm ERR! command sh -c -- node install.js npm ERR! RequestError: socket hang up npm ERR! at ClientRequest.<anonymous> (/Users/zhangjin/mycode/github/cursor/node_modules/got/dist/source/core/index.js:970:111) npm ERR! at Object.onceWrapper (node:events:628:26) npm ERR! at ClientRequest.emit (node:events:525:35) npm ERR! at ClientRequest.origin.emit (/Users/zhangjin/mycode/github/cursor/node_modules/@szmarczak/http-timer/dist/source/index.js:43:20) npm ERR! at TLSSocket.socketOnEnd (node:_http_client:518:9) npm ERR! at TLSSocket.emit (node:events:525:35) npm ERR! at endReadableNT (node:internal/streams/readable:1358:12) npm ERR! at connResetException (node:internal/errors:705:14) npm ERR! at TLSSocket.socketOnEnd (node:_http_client:518:23) npm ERR! at TLSSocket.emit (node:events:525:35) npm ERR! at endReadableNT (node:internal/streams/readable:1358:12) npm ERR! at processTicksAndRejections (node:internal/process/task_queues:83:21) npm ERR! A complete log of this run can be found in: npm ERR! /Users/xxxx/.npm/_logs/2023-04-08T09_03_45_778Z-debug-0.log
2 是国内的网络访问外围问题导致,换成国内的镜像源地址就好了。 我是安装模块electron报错,其他的也可以配置相应镜像,或者设置全局的镜像。
export ELECTRON_MIRROR=https://npm.taobao.org/mirrors/electron/
· Blazor Hybrid适配到HarmonyOS系统
· Obsidian + DeepSeek:免费 AI 助力你的知识管理,让你的笔记飞起来!
· 解决跨域问题的这6种方案,真香!
· 一套基于 Material Design 规范实现的 Blazor 和 Razor 通用组件库
· 5. Nginx 负载均衡配置案例(附有详细截图说明++)