You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

执行yarn install报错‘Internal Error: Error when performing the request’求助

解决yarn/npm安装依赖时的请求错误问题

问题详情

执行yarn install时触发以下错误:

Internal Error: Error when performing the request
    at ClientRequest.<anonymous> (C:\Program Files\nodejs\node_modules\corepack\dist\corepack.js:16073:20)
    at ClientRequest.emit (node:events:512:28)
    at TLSSocket.socketErrorListener (node:_http_client:496:9)
    at TLSSocket.emit (node:events:512:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

注:npm install在其他项目可正常运行,未使用代理。

解决方案

  • 清除包管理器缓存
    • 清理npm缓存:npm cache clean --force
    • 清理Corepack管理的yarn缓存:corepack yarn cache clean
  • 切换国内包源(规避网络请求超时)
    • 设置npm源:npm config set registry https://registry.npmmirror.com/
    • 设置yarn源:corepack yarn config set registry https://registry.npmmirror.com/
  • 重置项目依赖文件
    • 删除项目根目录下的package-lock.json、yarn.lock和node_modules文件夹
    • 重新执行npm install或yarn install
  • 修复Corepack环境
    • 重新启用Corepack:corepack enable
    • 重新安装Corepack:npm install -g corepack
  • 验证网络连通性
    • 在PowerShell中测试源地址可达性:Invoke-WebRequest https://registry.npmmirror.com/
    • 排查防火墙/安全软件是否拦截包管理器的网络请求

内容的提问来源于stack exchange,提问作者Nathaniel M.

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.02 03:55:17