Ionic Serve error - "This site can't be reached." (v2)


#1

OSX v.10.11.3 (beta)

So, I wanted to learn Ionic 2, so I did this:

$ npm uninstall -g ionic # because I had ionic v1
$ npm i -g ionic@beta
$ ionic start MyApp tutorial --v2 --ts # notice ts here
$ ionic serve --lab

It worked. After I played around with it for a while, I deleted the MyApp directory. The very next day I did the same sequence of commands (except the first two because I didn’t need to). But now Chrome was showing me a “This site can’t be reached” error. I have confirmed this happens on other browsers too (tested with Chrome, Safari, and Firefox). Both with and without the --lab option have the same issue. And this problem is reported only by the browser, ionic-cli doesn’t seem to realize this, so there are no error messages on its end. This is different from other similar issues in this way.

So then I be like, “You know what, I have a hunch…”. You see recently I had installed the latest version of Node from their website (at the time of writing this is v6.1.0). However I quickly realized that 99.99% of everything I used was currently incompatible with Node 6, I uninstalled it following a guide I hade Googled. But before I had install Node v6 I actually had used homebrew to install node via brew install node, which installs Node v5. I did not remember that at the time, and after I uninstall Node v6, I installed the LTS version of Node, which is currently v4.4.4. So now I had all these different versions of Node.js on my system. So I thought, OK, maybe some shit happened with the versions. So I painstakingly uninstalled every version of node until I was sure there were practically no remnants of it (and Ionic) on my system. Then I did a complete reinstall of everything, Node v5 (using brew), Cordova, Typescript, Ionic, ios-sim, ios-deploy, etc. etc. etc.

Then I followed the same commands, and got the same error. So I was like “Damnit, this seems like some sort of bug or something.” So here I am.

Let me know if you need to know the specifics of what I did, as I know a lot of things could have gone wrong here.

EDIT: Output of ionic info for more information:

Your system information:

Cordova CLI: 6.1.1
Gulp version: CLI version 1.2.1
Gulp local: Local version 3.9.1
Ionic Framework Version: 2.0.0-beta.6
Ionic CLI Version: 2.0.0-beta.25
Ionic App Lib Version: 2.0.0-beta.15
ios-deploy version: 1.8.6
ios-sim version: 5.0.8
OS: Mac OS X El Capitan
Node Version: v5.11.1
Xcode version: Xcode 7.3.1 Build version 7D1014

While these seem OK, I am not sure what exactly the issue is? Why did it suddenly change between one day and the next? I am really confused.


#2

What you get if you do ionic serve -c -s --lab - see any errors?


#3

@sveinla No errors, and the same problem.


#4

Can I bump this up? I’ve not exactly been able to accomplish anything because of this. I’ve tried every means I could think of, really. I need to find this out.


#5

Is there anything else that I need to provide? I’m really starting to get worried at this point.


#6

Hi I have tried following all your steps and the project works as expected.

Just checking you are running ionic serve from within the MyApp folder, correct?
try running ‘npm cache clean && npm install’ to see if a dependency didn’t pull down correctly.

Hope its something simple.


#7

@MagicAardvark Ah! Thanks for that, I got this when I ran npm cache clean && npm install:

npm WARN angular2@2.0.0-beta.15 requires a peer of reflect-metadata@0.1.2 but none was installed.
npm WARN angular2@2.0.0-beta.15 requires a peer of zone.js@^0.6.10 but none was installed.
npm WARN myapp@ No repository field.
npm WARN myapp@ No license field.

So then I did: (in the MyApp directory, of course) npm i --save reflect-metadata@0.1.2 zone.js and then I ran ionic serve --lab and …

it doesn’t work. :disappointed:


#8

Which version of ionic are you using? there were numerous changes in Angular around ngZone.

If you are on >beta.3 try following this guide


#9

As you can see from my ionic info results:

Your system information:

Cordova CLI: 6.1.1
Gulp version: CLI version 1.2.1
Gulp local: Local version 3.9.1
Ionic Framework Version: 2.0.0-beta.6 # Latest version
Ionic CLI Version: 2.0.0-beta.25 # Latest version
Ionic App Lib Version: 2.0.0-beta.15
ios-deploy version: 1.8.6
ios-sim version: 5.0.8
OS: Mac OS X El Capitan
Node Version: v5.11.1
Xcode version: Xcode 7.3.1 Build version 7D1014


#10

So there’s a lot here, and it may just easier to go through things one more time.

So

npm i -g ionic@beta

ionic start myApp --v2 --ts
cd myApp
ionic serve --lab

This gives you errors?


#11

@mhartington Slightly different.

 npm i -g ionic@beta
 ionic start MyApp **tutorial** --v2 --ts
 cd MyApp
 ionic serve --lab # even without --lab

Give me a second to verify without a starter.


#12

Yes, even without a starter gives me an error (on the browser side - “This site can’t be reached”)


#14

@mhartington By the way, seeing as this forum is not the ideal place to discuss things because of the time limit on replies, I had opened an issue on driftyco/ionic-cli of the same name: https://github.com/driftyco/ionic-cli/issues/998


#15

@mhartington Ok, this is very odd. Just for testing, I added the “MyApp” directory to Ionic Lab, and I used the serve thing. It worked! I always assumed that they used the command line under the hood. Apparently not, I think. With this new info, what do you think the problem could be (I prefer to remain in the command line, so I need to fix that)


#16

@eshansingh are you cd’ing into the directory after creating the project?


#17

Yes. I know my way around, really. There’s definitely something more to this. Also why does the forum limit the amount of time between a post and a reply? It seems odd.


#18

It shouldn’t, but it may be to prevent any spam.

Alright… :thinking:

hmm, let move this to the github issue then. As i’m not sure what could be going on, and it would help to get the CLI folks thoughts on this.


#19

Yes I have it here https://github.com/driftyco/ionic-cli/issues/998 however it had not recived enough attention so I posted it here.


#20

Did you ask them? The GitHub issue has nothing. I apologize for bothering you so much… just wanted to know.


#21

OK, so all of a sudden this is working in Firefox. Chrome and Safari still don’t work. Looks like it’s some problem with WebKit, or something … but why didn’t it work in Firefox earlier. Absolutely nothing changed from one day to the next! Why would it be so erratic?