Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native expo init command failed

I wanted to follow this tutorial (https://facebook.github.io/react-native/docs/getting-started.html) to start learning react-native.

I followed the first steps and I ran into some issues on the command line: expo init AwesomeProject

Here's the log :

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.

I searched on the github page and on forums but didn't find info on this. I also tried this :

deleted files in .expo folder
npm -g uninstall expo-cli --save
npm install -g expo-cli@latest

But same issue.

blank-31.0.0.tar.gz file is empty with only html tags. Might be the issue but I don't know what to do...

Thanks

like image 863
AnthonyDa Avatar asked Oct 17 '22 10:10

AnthonyDa


2 Answers

Just run in cmd insted of Gitbash

like image 71
Sijo Avatar answered Oct 20 '22 21:10

Sijo


Same issue here, seems like a network problem to me.

I dug into the source code of expo-cli, found the download link for the template:

"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"
    }
  ],

So I manually download the file and unzip, cd into it and run expo start... and got stuck for about 20 minutes.

After I lost my patience and pressed Ctrl+C to kill this process, then I tried npm run android and it worked!

I also tried npm start afterwards, and it seems to work too.

like image 44
westlin Avatar answered Oct 20 '22 20:10

westlin