最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】react-native init AwesomeProject太慢

React Native crifan 6470浏览 0评论

折腾:

【记录】折腾React Native iOS

期间,想办法去看看,能否解决:

此处的

react-native init AwesomeProject

太慢,没有进度了。

注意,此处是用shadowsocks翻墙的,所以估计才能正常下载代码的:

但是好像(翻墙后的)网速很不稳定?

导致下载文件都不顺畅

实在不行,用Command+C去中断了,重新开始:

➜  react_native react-native init AwesomeProject
This will walk you through creating a new React Native project in /Users/crifan/dev/dev_root/daryun/KeYouTong/2.0/sourcecode/react_native/AwesomeProject
Using yarn v0.21.3
Installing react-native…
yarn add v0.21.3
info No lockfile found.
[1/4] ?  Resolving packages…
warning There appears to be trouble with your network connection. Retrying…
warning There appears to be trouble with your network connection. Retrying…
warning There appears to be trouble with your network connection. Retrying…
warning There appears to be trouble with your network connection. Retrying…
warning There appears to be trouble with your network connection. Retrying…
warning There appears to be trouble with your network connection. Retrying…
warning There appears to be trouble with your network connection. Retrying…
warning react-native > xcode > [email protected]: use uuid module instead
[2/4] ?  Fetching packages…
warning There appears to be trouble with your network connection. Retrying…
warning There appears to be trouble with your network connection. Retrying…
████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████░ 466/468^C
➜  react_native react-native init AwesomeProject
prompt: Directory AwesomeProject already exists. Continue?:  (no) yes
This will walk you through creating a new React Native project in /Users/crifan/dev/dev_root/daryun/KeYouTong/2.0/sourcecode/react_native/AwesomeProject
Using yarn v0.21.3
Installing react-native…
yarn add v0.21.3
info No lockfile found.
[1/4] ?  Resolving packages…
warning There appears to be trouble with your network connection. Retrying…
warning There appears to be trouble with your network connection. Retrying…
warning There appears to be trouble with your network connection. Retrying…
warning There appears to be trouble with your network connection. Retrying…
warning react-native > xcode > [email protected]: use uuid module instead
[2/4] ?  Fetching packages…
█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ 467/468

react native fetching packages

react-native init fetching packages

about react-native init AwesomeProject? · Issue #841 · facebook/react-native · GitHub

去试试加–verbose

目前是一直死在:

verbose 67.735 Performing "GET" request to "https://registry.yarnpkg.com/generate-object-property".
verbose 67.737 Performing "GET" request to "https://registry.yarnpkg.com/jsonpointer".
verbose 67.932 Request "https://registry.yarnpkg.com/jsonpointer" finished with status code 200.
verbose 68.003 Request "https://registry.yarnpkg.com/generate-object-property" finished with status code 200.
verbose 68.006 Performing "GET" request to "https://registry.yarnpkg.com/is-property".
verbose 68.193 Request "https://registry.yarnpkg.com/is-property" finished with status code 200.
verbose 68.239 Request "https://registry.yarnpkg.com/generate-function" finished with status code 200.
[2/4] ?  Fetching packages…
verbose 69.336 Performing "GET" request to "https://registry.yarnpkg.com/react-native/-/react-native-0.42.0.tgz".
█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ 467/468

对于:

https://registry.yarnpkg.com/react-native/-/react-native-0.42.0.tgz

单独放在浏览器中下载,则是可以的。。

等了足够长时间后,终于可以正常继续下载了:

文件夹中可以看到一堆文件了:

最终,下载完毕:

[2/4] ?  Fetching packages…
[3/4] ?  Linking dependencies…
[4/4] ?  Building fresh packages…
success Saved lockfile.
success Saved 141 new dependencies.
✨  Done in 76.72s.
To run your app on iOS:
   cd /Users/crifan/dev/dev_root/daryun/KeYouTong/2.0/sourcecode/react_native/AwesomeProject
   react-native run-ios
   – or –
   Open ios/AwesomeProject.xcodeproj in Xcode
   Hit the Run button
To run your app on Android:
   cd /Users/crifan/dev/dev_root/daryun/KeYouTong/2.0/sourcecode/react_native/AwesomeProject
   Have an Android emulator running (quickest way to get started), or a device connected
   react-native run-android

【总结】

此处,对于react-native init太慢,其实在确保翻墙可以下载后,剩下好像没有什么好办法,只能多试几次。好像就可以了。

当前,期间,至少可以加上 

–verbose

参数,看看到底卡在哪里,便于找出错误原因。

转载请注明:在路上 » 【已解决】react-native init AwesomeProject太慢

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
89 queries in 0.166 seconds, using 22.13MB memory