Ant*_*yDa 5 npm react-native expo
我想按照本教程(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.
Run Code Online (Sandbox Code Playgroud)
我在github页面和论坛上搜索,但未找到相关信息。我也尝试过这个:
deleted files in .expo folder
npm -g uninstall expo-cli --save
npm install -g expo-cli@latest
Run Code Online (Sandbox Code Playgroud)
但是同样的问题。
blank-31.0.0.tar.gz文件为空,仅包含html标记。可能是问题,但我不知道该怎么办...
谢谢
小智 2
这里同样的问题,对我来说似乎是网络问题。
我深入研究了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"
}
],
Run Code Online (Sandbox Code Playgroud)
所以我手动下载文件并解压,cd 到它并运行expo start......并且卡住了大约 20 分钟。
当我失去耐心并按Ctrl+C杀死这个进程后,我尝试了一下,npm run android它成功了!
后来我也尝试了一下npm start,似乎也有效。
| 归档时间: |
|
| 查看次数: |
2985 次 |
| 最近记录: |