V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
yazoox
V2EX  ›  程序员

请教一下,为什么我的 yarn 连接不上 https://registry.yarnpkg.com, timeout error

  •  
  •   yazoox · 2020-04-22 11:43:08 +08:00 · 5160 次点击
    这是一个创建于 1473 天前的主题,其中的信息可能已经有所发展或是发生改变。

    我输入 create-react-app myapp --typescript

    然后得到下面的错误提示

    google 了一下,什么--timeout=999999,重启机器,设置 npm registry,node 换成 10.0+,检查 ie 设置,也没有设置 proxy,好像都没有用。还是报一样的错误。

    请有经验的大神帮忙看一眼。

    系统是 windows10

    c:\users<username>\.npmrc 里面,指向国内的地址,应该没有问题吧?

    registry=https://registry.npm.taobao.org/

    yarn add v1.22.4
    [1/4] Resolving packages...
    [2/4] Fetching packages...
    info There appears to be trouble with your network connection. Retrying...
    info There appears to be trouble with your network connection. Retrying...
    info There appears to be trouble with your network connection. Retrying...
    info There appears to be trouble with your network connection. Retrying...
    error An unexpected error occurred: "https://registry.yarnpkg.com/babel-jest/-/babel-jest-24.9.0.tgz: connect ETIMEDOUT 104.16.16.35:443".
    info If you think this is a bug, please open a bug report with the information provided in "C:\\src\\myapp\\yarn-error.log".
    info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
    
    Aborting installation.
      yarnpkg add --exact react react-dom react-scripts cra-template-typescript --cwd C:\src\myapp has failed.
    
    Deleting generated file... package.json
    Deleting generated file... yarn.lock
    Done.
    

    找到一个 yarn-error.log 文件,主要 信息如下:

    
    Yarn version: 
      1.22.4
    
    Node version: 
      8.10.0
    
    Platform: 
      win32 x64
    
    Trace: 
      Error: connect ETIMEDOUT 104.16.16.35:443
          at Object._errnoException (util.js:1022:11)
          at _exceptionWithHostPort (util.js:1044:20)
          at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1198:14)
    
    npm manifest: 
      {
        "name": "myapp",
        "version": "0.1.0",
        "private": true
      }
    
    yarn manifest: 
      No manifest
    
    2 条回复    2020-04-22 11:50:04 +08:00
    Virace
        1
    Virace  
       2020-04-22 11:46:07 +08:00 via Android
    yarn config set registry https://registry.npm.taobao.org/
    yazoox
        2
    yazoox  
    OP
       2020-04-22 11:50:04 +08:00
    @Virace 谢谢! it works. 这么简单就解决了......
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2428 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 03:14 · PVG 11:14 · LAX 20:14 · JFK 23:14
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.