ionic-team / ionic-cli

The Ionic command-line interface
MIT License
2k stars 649 forks source link

Timeout Issue - start #2256

Closed kumaresan-cgvak closed 7 years ago

kumaresan-cgvak commented 7 years ago

Note: for support questions, please use one of these channels:

https://forum.ionicframework.com/ http://ionicworldwide.herokuapp.com/

Note: for build related issues you can open up an issue on the ionic-app-scripts repo

https://github.com/driftyco/ionic-app-scripts

Please ensure that you are on the latest version of the CLI. npm view ionic@latest version

Short description of the problem:

Unable to create new project with sidemenu template.

What behavior are you expecting?

To create a sidemenu template app with name myApp using ionic start myApp sidemenu

Steps to reproduce:

  1. install latest version if CLI. (Version 3.0.0)
  2. try to create a new project using ionic start myApp sidemenu
ionic start myApp sidemenu
✔ Creating directory /Users/kumaresan/Desktop/untitled folder/myApp - done!
Fetching app base (https://github.com/driftyco/ionic2-app-base/archive/master.tar.gz)
✖ Downloading - failed!
Error: Timeout of 25000ms reached for https://github.com/driftyco/ionic2-app-base/archive/master.tar.gz

Post the output of ionic info below please global packages:

@ionic/cli-utils : 1.0.0
Ionic CLI        : 3.0.0

System:

Node       : v7.10.0
OS         : macOS Sierra
Xcode      : Xcode 8.3.1 Build version 8E1000a 
ios-deploy : 1.9.1 
ios-sim    : 5.0.13 

Other information: (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc)

janpio commented 7 years ago

Can you download the file https://github.com/driftyco/ionic2-app-base/archive/master.tar.gz manually? How long does it take? How fast is your internet? Anything special about your internet connection or network (monitoring, proxy, cencorship...)?

kumaresan-cgvak commented 7 years ago

@piotrowski yes i could download the file manually. Download starts within milli seconds. Speed is around 1.93 Mbps. yes we have a dedicated firewall.

janpio commented 7 years ago

Would it be possible that you terminal can't access the internet because of this Firewall? Maybe try executing wget https://github.com/driftyco/ionic2-app-base/archive/master.tar.gz to check (although I don't know enoug about Mac to know if this would be enough as a test)

kumaresan-cgvak commented 7 years ago

yes i could download it using curl -O https://github.com/driftyco/ionic2-app-base/archive/master.tar.gz

Also it is not the first time am using Ionic CLI. This issue occurs after updating to the Latest CLI only.

RodgerLai commented 7 years ago

have you resolve this problem? if you do ,teach me,thank you !

kumaresan-cgvak commented 7 years ago

@RodgerLai not yet...

vjunjoced commented 7 years ago

I also have the same problem

RodgerLai commented 7 years ago

@kumaresan-cgvak i uninstall ionic,then install again and create hello word successfully !

ghost commented 7 years ago

@RodgerLai It doesn't solve the problem. Please team help us with the fix. I can help from my side to collect more information on this issue.

imhoffd commented 7 years ago

@kumaresan-cgvak @ramsundhar20 @vjunjoced I'm guessing the issue is due to your firewall. (Assuming you all have firewalls.) While curl and wget in your terminal may work, node programs such as npm and ionic need separate configuration for firewalls.

This is a known issue with the latest CLI and is being tracked here: https://github.com/driftyco/ionic-cli/issues/2234

Please update this issue if any of you are not using a firewall.

As a workaround, please downgrade to the legacy CLI: npm i -g ionic@legacy

mumairofficial commented 7 years ago

it was very strange for me... after upgrading CLI to 3.0.0 I also start facing this problem but when I tried same command ionic start myProject blank from powershell then it worked!

ghost commented 7 years ago

@dwieeb No firewalls. I am working in my home in my personal laptop. I don't think ISP would be blocking github.

npm i -g ionic@legacy

The above command is working perfectly.

RodgerLai commented 7 years ago

@ramonornela uninstall and install ionic is not good resolution. run ':npm i -g ionic@legacy' ,that's working,thank you ! but how do you know the '@legacy' param. teach me,thanks~

imhoffd commented 7 years ago

@RodgerLai https://github.com/driftyco/ionic-cli/blob/master/README.md#legacy-version

imhoffd commented 7 years ago

@ramsundhar20 The new CLI has a timeout of 25 seconds. I'd like to debug this with you. Obviously using the legacy CLI is not a long-term solution. Can you answer these questions?

Can you download the file https://github.com/driftyco/ionic2-app-base/archive/master.tar.gz manually? How long does it take? How fast is your internet? Anything special about your internet connection or network (monitoring, proxy, cencorship...)?

ghost commented 7 years ago

@dwieeb Please find the answers that you require Yes, I can manually download the file. It took 15 secs I am using a 10 Mbps connection My internet is not under any monitoring or proxy..

When doing wget I noticed that github is doing a redirection for file download. Is it handled in the new CLI. I doubt that would be the cause.

Please let me know, if you need further information.

imhoffd commented 7 years ago

@ramsundhar20

Yes, the library we're using in the CLI for HTTP (superagent) follows redirects. How long does a typical ionic start take with the legacy (2.x) CLI for you?

Perhaps simply increasing the timeout will work for you for now. Your Github profile says you're in India. I think a better solution might be to offer a globally distributed CDN download to make this a better experience. I'm not sure if Github does this themselves or not.

Could you please paste the output of running ping codeland.github.com for a few seconds on the command line?

Kangmo commented 7 years ago

+1

imhoffd commented 7 years ago

@Kangmo Please elaborate.

Kangmo commented 7 years ago

This morning, I tried to create Ionic app and chose 'conference' but failed to download the conference in 25s, which is the time limit with my cell phone which has 3Mbps bandwidth.

But now it successfully downloaded. Looks like it was a server issue, when the server is congested, looks like one can not download the file in 25 seconds.

https://github.com/driftyco/ionic-conference-app/archive/master.tar.gz

Thanks for the great tool~!~!~! I love ionic!

ricmello commented 7 years ago

@Kangmo you're right. We have slow network connections here where I live in Brazil, then I can reproduce the issue perfectly.

I can start a tabs, blank or sidemenu app because it only has a few KB. When I try start a conference app, which download file has almost 6MB, I can see the download running through network but the timeout is reached because the internet speed is insufficient.

@dwieeb I think that the solution in this case is just increase the timeout.

fssgh commented 7 years ago

Modify this code!!!! path:C:\Users...\AppData\Roaming\npm\node_modules\ionic\dist\lib\start.js

Object.defineProperty(exports, "__esModule", { value: true }); const fs = require("fs"); const path = require("path"); const zlib = require("zlib"); const tar = require("tar"); const chalk = require("chalk"); const cli_utils_1 = require("@ionic/cli-utils"); function tarXvfFromUrl(url, destination) { return new Promise((resolve, reject) => { const archiveRequest = cli_utils_1.createRequest('get', url)

.timeout(25000)

        .on('response', (res) => {
        if (res.statusCode !== 200) {
            reject(new Error(`Encountered bad status code (${res.statusCode}) for ${url}\n` +
                `This could mean the server is experiencing difficulties right now--please try again later.\n\n` +
                `If you're behind a firewall, you can proxy requests by using the HTTP_PROXY or IONIC_HTTP_PROXY environment variables.`));
        }
    })
imhoffd commented 7 years ago

@Kangmo @ricardo-mello @fssgh Thanks! I'll increase the timeout to 3 minutes for now, but I really want to look into speeding this up in the future.

I did not know the conference app was such a beast.

If you like, you can test with npm i -g ionic@canary.

CarlosTheory commented 7 years ago

I have the same problem but in ubuntu, I can not find the file :c Windows be like:

path:C:\Users...\AppData\Roaming\npm\node_modules\ionic\dist\lib\start.js

Ubuntu be like: ? :c

ricmello commented 7 years ago

@CarlosTheory please try to update ionic to latest version running npm i -g ionic@canary as @dwieeb said. Don't need to edit start.js manually.

CarlosTheory commented 7 years ago

@ricardo-mello I just read it :/ I edited the file in

/usr/lib/node_modules/ionic/dist/lib/start.js

It works, but now I have other problem it says npm stopped working

kanoor commented 7 years ago

Disable you Firewall it will work ...

imhoffd commented 7 years ago

@kanoor Many people use Ionic for their work and have corporate firewalls that they cannot disable.

depgiuseppe commented 7 years ago

I solve just close the localhost chrome tab.

sid-Puttur commented 7 years ago

I am able to solve this problem by creating a new folder for the project and running the start command with template name and not by selecting the template. eg: ionic start mynewproject sidemenu

yanglinux commented 7 years ago

npm i -g ionic@canary

great, fix it 。txh