V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
yazoox
V2EX  ›  程序员

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

  •  
  •   yazoox · Apr 22, 2020 · 5680 views
    This topic created in 2206 days ago, the information mentioned may be changed or developed.

    我输入 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 replies    2020-04-22 11:50:04 +08:00
    Virace
        1
    Virace  
       Apr 22, 2020 via Android
    yarn config set registry https://registry.npm.taobao.org/
    yazoox
        2
    yazoox  
    OP
       Apr 22, 2020
    @Virace 谢谢! it works. 这么简单就解决了......
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3495 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 11:39 · PVG 19:39 · LAX 04:39 · JFK 07:39
    ♥ Do have faith in what you're doing.