gpt4 book ai didi

react-native - React Native expo init 命令失败

转载 作者:行者123 更新时间:2023-12-04 21:30:37 25 4
gpt4 key购买 nike

我想按照本教程 ( https://facebook.github.io/react-native/docs/getting-started.html ) 开始学习 react-native。

我遵循了第一步,但在命令行上遇到了一些问题:expo init AwesomeProject

这是日志:

PS C:\Users\ANTD\react_native> expo init AwesomeProject2
? Choose a template: blank
[09:06:11] Extracting project files...
Process exited with non-zero code: 2
ERROR: C:\Users\ANTD\.expo\starter-app-cache\blank-31.0.0.tar.gz
C:\Users\ANTD\.expo\starter-app-cache\blank-31.0.0.tar.gz
Open ERROR: Can not open the file as [gzip] archive


ERRORS:
Is not archive

Process exited with non-zero code: 2
[09:06:11] Customizing project...
[09:06:11] ENOENT: no such file or directory, open 'C:\Users\ANTD\react_native\AwesomeProject2\app.json'
[09:06:11] Set EXPO_DEBUG=true in your env to view the stack trace.

我在 github 页面和论坛上搜索过,但没有找到相关信息。
我也试过这个:
deleted files in .expo folder
npm -g uninstall expo-cli --save
npm install -g expo-cli@latest

但同样的问题。

blank-31.0.0.tar.gz 文件是空的,只有 html 标签。
可能是问题,但我不知道该怎么办...

谢谢

最佳答案

同样的问题,对我来说似乎是网络问题。

我挖了expo-cli的源代码,找到模板的下载链接:

"templatesv2": [
{
"description": "The Blank project template includes the minimum dependencies to run and an empty root component.",
"iconUrl": "https://d306o6r76fnu7o.cloudfront.net/template_icon_blank.png",
"id": "blank",
"name": "Blank",
"url": "https://d306o6r76fnu7o.cloudfront.net/blank-31.0.0.tar.gz",
"version": "31.0.0"
},
{
"description": "The Tab Navigation project template includes several example screens.",
"iconUrl": "https://d306o6r76fnu7o.cloudfront.net/template_icon_tabs.png",
"id": "tabs",
"name": "Tab Navigation",
"url": "https://d306o6r76fnu7o.cloudfront.net/tabs-31.0.0.tar.gz",
"version": "31.0.0"
}
],

所以我手动下载文件并解压缩,cd 到其中并运行 expo start ...并被卡住了大约 20 分钟。

在我失去耐心并按 Ctrl+C 终止此进程后,我尝试了 npm run android它奏效了!

我也试过 npm start之后,它似乎也有效。

关于react-native - React Native expo init 命令失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53315048/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com