Unable to Start an application using ionic

Hi Team,

I’m new to Ionic and tried creating an application using the below command

C:\Windows\System32>ionic start myFirstApp tabs

I’ve the below error

C:\Windows\System32>ionic start myFirstApp tabs
Creating an Ionic 2.x app in C:\Windows\System32\myFirstApp based on the tabs te
mplate.

Downloading: https://github.com/driftyco/ionic2-app-base/archive/master.zip
Error with start Error: connect ETIMEDOUT 192.30.253.112:443
at Object.exports._errnoException (util.js:1050:11)
at exports._exceptionWithHostPort (util.js:1073:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1097:14)
Error Initializing app: Error: connect ETIMEDOUT 192.30.253.112:443
Error: connect ETIMEDOUT 192.30.253.112:443
at Object.exports._errnoException (util.js:1050:11)
at exports._exceptionWithHostPort (util.js:1073:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1097:14)

My System Information:-


Cordova CLI: 6.5.0
Ionic CLI Version: 2.2.3
Ionic App Lib Version: 2.2.1
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 7
Node Version: v7.9.0
Xcode version: Not installed

Kindly help me on this…

Your command line can’t download the zip file that contains part of the template.

Can you open https://github.com/driftyco/ionic2-app-base/archive/master.zip in your browser?

Yes I’m able to open it through my browser and extract it. Is there something (Like a proxy) that I need to configure in my local ?

In the default case, no.

What Commandline are you using? CMD or PowerShell?
On Powershell you can just do curl https://github.com/driftyco/ionic2-app-base/archive/master.zip to see if the command line can normally download that file. That should work.

I was using Node.js Command Prompt as an Administrator. I don’t have PowerShell installed on my client’s laptop

Ok, I don’t know that one.

Still, something is blocking requests to github on this machine. Maybe it uses a proxy on everything else that isn’t set for the command line?

Simple fix often is to just connect to the tethering hotspot of your mobile device and use this connection to download the stuff you need.

Ok Sujan, let me try installing PowerShell and give a try on what you’ve suggested.

One more question is, which ever application name I gave in my START command, it is downloading from the same URL ( https://github.com/driftyco/ionic2-app-base/archive/master.zip) …

Eg:- >ionic start myFirstApp tabs

(Or)

Eg:- >ionic start Test blank

In both the cases, github URL is same… Any specific reason for this ?

It’s attempting to download from the ionic2-app-base repo, which as the name implies is the base template for an Ionic app. Hence, no matter which template you use it’ll still use the core/base template.

1 Like

The real template will be added in the next step - another download.

1 Like

Before installing PowerShell, I’ve manually downloaded the ionic2-app-base-master.zip from github to C:\Windows\System32 directory and unzipped.

Now, in Node.js command prompt, I’ve gone to unzipped directory and ran “ionic serve” command. It threw the below error.


C:\Windows\System32\myFirstApp>ionic serve
WARN: No node_modules directory found, do you need to run npm install?

ionic-app-base@0.0.0 ionic:serve C:\Windows\System32\myFirstApp
ionic-app-scripts serve “–v2” “–address” “0.0.0.0” “–port” “8100” “–livere
load-port” “35729”

‘ionic-app-scripts’ is not recognized as an internal or external command,
operable program or batch file.

npm ERR! Windows_NT 6.1.7601
npm ERR! argv “C:\Program Files\nodejs\node.exe” “C:\Program Files\nodejs\
node_modules\npm\bin\npm-cli.js” “run” “ionic:serve” “–” “–v2” “–address”
“0.0.0.0” “–port” “8100” “–livereload-port” “35729”
npm ERR! node v7.9.0
npm ERR! npm v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ionic-app-base@0.0.0 ionic:serve: ionic-app-scripts serve "--v2" "--ad dress" "0.0.0.0" "--port" "8100" "--livereload-port" "35729"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ionic-app-base@0.0.0 ionic:serve script 'ionic-app-script
s serve “–v2” “–address” “0.0.0.0” “–port” “8100” “–livereload-port” “35729”
'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ionic-app-base packag
e,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ionic-app-scripts serve “–v2” “–address” “0.0.0.0” “–port” "8100
" “–livereload-port” “35729”
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs ionic-app-base
npm ERR! Or if that isn’t available, you can get their info via:
npm ERR! npm owner ls ionic-app-base
npm ERR! There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to in
stall?

npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\JMP829\AppData\Roaming\npm-cache_logs\2017-05-02T15_52_39
_422Z-debug.log
There was an error serving your Ionic application: There was an error with the s
pawned command: serve

You have to run npm install inside your unziped folder.

You have to download and unzip these two repos into the same folder:


Then run npm install inside the folder and you can run ionic serve.

The CLI does nothing more then this 3 steps

1 Like

We need to install npm in the unzipped path only if we download manually ?

Also, I’ve already ran npm install -g ionic and npm install -g cordova under C:\Windows\System32 folder. Does this install different from what I need to install again now ?

If you run npm install -g ionic you install the Ionic CLI globally. The CLI helps you to start a new project, build it with Cordova etc.
When you run ionic start hello-world tabs the CLI do this three steps for you.

  1. Downloading the base repo
  2. Downloading the template (tabs, blank, sidemenu, …)
  3. The CLI unzips these two repositories in one folder called by your project name
  4. The CLI runs npm install inside this folder to install all required dependencies (you can find them in the package.json file)

You can do all these four steps without the CLI manually as I posted before.

1 Like

One question, you are behind a proxy, right? Have you set the proxy settings for npm?

If not you should do it to fix problems with npm. Some Cordova plugins for example also download their files from a GitHub source. To prevent these errors you can follow this guide: https://jhipster.github.io/configuring-a-corporate-proxy/

Because you are not the first person with this problem, I will create a workaround page in the ionic documentation in the next few days.

1 Like

Yeah I have set the proxy in a config file…

As Sujan mentioned, apart from PowerShell, is there an alternative to mitigate my actual problem (original error) ? Unable to download from Gihub through Node.js command prompt.

Hi chaitanya,

I am having the same issue. I have set proxy in npm, environment variable but it’s not working.

did you resolve this issue?

Regards,

I think there is an issue with in JS of the latest version. It working in ionic 2.2.3 for me. i can download ionic-app-base and ionic2-starter-tab if i install ionic 2.2.3.

Hi Team/Chaitanya,

I am facing the same issue.

While starting a new project its showing me the below error message.

D:\ionicProjects>ionic start Simple blank
x Downloading and extracting blank starter - failed!
Error: connect ETIMEDOUT 52.222.136.33:443
at Object.exports._errnoException (util.js:1020:11)
at exports._exceptionWithHostPort (util.js:1043:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1090:14)

Please help me.

Thanks and Regards,
Surendra.