我想按照本教程(https://facebook.github.io/react-native/docs/getting-started.html)开始学习本机语言。
我遵循了第一步,在命令行上遇到了一些问题: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标记。 可能是问题所在,但我不知道该怎么办...
谢谢
答案 0 :(得分:1)
这里有同样的问题,对我来说似乎是网络问题。
我研究了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
,它似乎也可以工作。
答案 1 :(得分:0)
只需在装有Gitbash的cmd中运行