ionic --version3.0.0-beta.4
ionic-cli can´t download templates behind proxy. I have no problem with 2.2 version.
Download templates using nodejs proxy configuration
Steps to reproduce:
Post the output of ionic info below please
Cordova CLI: 6.5.0
Ionic CLI Version: 3.0.0-beta.4
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v7.3.0
Xcode version: Not installed
Other information: (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc)
D:\tmp>ionic start blank blank --v2 --skip-npm
✔ Creating directory D:\tmp\blank - done!
✖ Downloading 'blank' starter template - failed!
{ Error
at ClientRequest.<anonymous> (D:\nodejs\pnpm-global\node_modules\.registry.npmjs.org\node-fetch\1.6.3\node_modules\node-fetch\index.js:133:11)
at emitOne (events.js:96:13)
at ClientRequest.emit (events.js:188:7)
at TLSSocket.socketErrorListener (_http_client.js:309:9)
at emitOne (events.js:96:13)
at TLSSocket.emit (events.js:188:7)
at emitErrorNT (net.js:1281:8)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
name: 'FetchError',
message: 'request to https://github.com/driftyco/ionic2-app-base/archive/master.tar.gz failed, reason: connect ECONNREFUSED 192.30.253.113:443',
type: 'system',
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED' }
D:\tmp>
Any news about that?
Can you verify did this issue not appear for the v2 CLI? The templates are being downloaded directly from github.
@jthoms1
I am experiencing the same issue here.
This issue doesn't happen on CLI v2!
I will look into this further not sure how I can reproduce, but I will research.
The problem is that the script doesn't use proxy environment configuration to download the templates... I could confirm this, by following these steps:
$ docker run -it --name cntlm -p 3128:3128 vcatechnology/linux-mint bash
$ apt update
$ apt install vim cntlm net-tools
$ ps -ef
$ kill -9 xxxx (pid from cntlm)
$ ifconfig
save the ip address to use in the second container (mine was 172.17.0.2)
Proxy :12345
Gateway yes
NoProxy ,localhost, 127.0.0., 10., 192.168.
Listen 0.0.0.0:3128
- and start cntlm showing the log in console like this:
$ cntlm -v
this concludes the cntlm config...
you can test the container, configuring firefox to use proxy:
about:preferences#advanced - network - configure connection - set manual proxy for
localhost port 3128
and access any page on the internet... you should see the log spitting the traffic in cntlm container.
Now, start another container that will use this first container as a proxy, following these steps:
- run a docker container (just linux) with the following command
$ docker run -it --name ionic -p 8100:8100 vcatechnology/linux-mint bash
- then install some software like this:
$ apt update
$ apt install vim net-tools npm
$ npm i -g n
$ n 7
$ export http_proxy=http://172.17.0.2
$ export https_proxy=http://172.17.0.2
remember that "172.17.0.2" was the ip address from the first container
$ npm i -g ionic@beta
- And before running the next step, make sure you can see the log in the cntlm container...
You should realize that, all http traffic is being redirect to the proxy container, except the template donwload itself... in other words, as soon as the template download is finished, the npm install starts and the cntlm log starts to spit the http traffic:
$ ionic start project1 blank
______________________________________________________________________________________________________
Well... I was trying to understand the code (https://github.com/driftyco/ionic-cli/blob/v3/packages/ionic/src/commands/start.ts#L199) and how to set proxy... actually, you can use something like the following code, when http_proxy and https_proxy environment variables, or .npmrc (proxy and https_proxy settings) are set:
fetch('https://www.google.com',{ agent:new HttpsProxyAgent('http://172.17.0.2:3128')}).then(function(res){
...
})
```
code from https://github.com/bitinn/node-fetch/issues/79#issuecomment-184594701
Hope you can reproduce my test and that it helps you to correct the bug. If you need any more help with the test case, just let me now.
@alexgv99 @jvitor83 @elTorres This will be fixed in the next release of CLI v3 beta. We now look at the same environment variables as npm (http_proxy, etc) as well as IONIC_HTTP_PROXY in case somebody needs to route traffic through a different proxy for just ionic traffic.
What is the workaround until then? I am unable to start a new Ionic project no matter what proxy config I use.
@frostbytedata This has been fixed for quite a while in the v3 beta.
Ok I'm running 3.0.0rc2 and I still have this issue. Is that the absolute latest, or do I have some other network issue at play here? Thanks so much for your help, really love this framework and community.
@frostbytedata Hmm, that's odd. Have you set the HTTP_PROXY environment variable?
@dwieeb Yes Dan I did have those set. However it seems the issue resolved itself after deleting, cleaning npm cache, and then reinstalling the Ionic CLI.
Thanks again for your help, I don't know how you guys manage to help idiots like me all day without throwing in the towel. It is appreciated here.
@frostbytedata Actually, I might be the idiot here! The CLI won't be able to proxy for global commands yet: https://github.com/driftyco/ionic-cli/issues/2234
I ran into this problem today and after a whole day's struggling, I fixed it.
Probably you are behind a proxy server.
First, make sure you can use "git" properly.
Because IONIC use git to download starter templates.
git config --global http.sslverify false
git config --global http.sslcainfo "path to your certificate file *.crt"
(You may also set "user.name" and "user.email" values if you have a git hub account.)
Second, let "npm" not to check ssl certificate
npm config set strict-ssl false
npm config set registry "http://registry.npmjs.org/" --global
Third, make "Node.js" not to check ssl certificate.
On Windows Powershell, type
$env:NODE_TLS_REJECT_UNAUTHORIZED ="0"
then try again.
ionic start blank blank
Good Luck.
@captainhook99999
The Ionic CLI does not use git to download starters unless you specify a git url.
Turning off SSL verification anywhere could not be discouraged more. If you are getting SSL issues, you likely need to update your system to get new CA certificates installed OR you are behind a proxy and your system or proxy is improperly configured. Talk with your proxy server administrator.
Hello All,
im getting an error while starting a new project
command -ionic start myapp tabs
error
:downloading and extracting tabs starter - failed!
error: connect ETIMEDOUT 54.230.0.136.443
at object.exports._errnoException
at exports._expectionWithHostPort
at TCPConnectWrap.afterConnect [as oncomplete]
Im new to ionic
please help me
@ragul13 Please carefully follow the instructions for setting up a proxy: https://ionicframework.com/docs/cli/configuring.html#using-a-proxy