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

2020-04-22 11:43:08 +08:00
 yazoox

我输入 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
5189 次点击
所在节点    程序员
2 条回复
Virace
2020-04-22 11:46:07 +08:00
yarn config set registry https://registry.npm.taobao.org/
yazoox
2020-04-22 11:50:04 +08:00
@Virace 谢谢! it works. 这么简单就解决了......

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/664931

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX