5
votes

I have started a clean project with ionic2 based on tabs template, by following the next steps:

$ ionic start <myapp> --v2
$ cd <myapp>
$ ionic serve

Then the output from ionic serve is just:

> ionic-hello-world@ ionic:serve /home/luan/<myapp>
> ionic-app-scripts serve "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729"

If I try to open localhost:8100 there's no response.

The files and code of the project are just the same as one using tabs template, but it's just don't wonking. Could someone help?

UPDATE: My ionic info

My system information:
Cordova CLI: 6.5.0
Ionic Framework Version: 2.3.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.2.2
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.4
Node Version: v6.10.0
Xcode version: Not installed
4

4 Answers

10
votes

Have you tried using

npm run ionic:serve

3
votes

I have found the answer. It turns out, the 1.2.2 version of Ionic App Scripts (app-scripts) version was the problem. Just downgraded to 1.1.4 and works fine. The actual workaround:

in package.json, change

"@ionic/app-scripts": "1.2.2" 

to

"@ionic/app-scripts": "1.1.4"

then run npm install again. It should show something like this:

[...]
- [email protected] node_modules/sentence-case
- [email protected] node_modules/change-case
ionic-hello-world@ /home/luan/Projetos/prestacontas
└── @ionic/[email protected] ## The problem was here

Make shure that @ionic/app-scripts is now 1.1.4, and not 1.2.2.

And that's it.

3
votes

Here is a solution for you,,, :)

Most probably this can be an issue of updating. Because I opened two of my ionic projects. one is from late 2017. For that project live reload is working without an issue. The problem with my new project. I checked the "ionic info" and found that both are same other than the ionic framework version. my older one is v 3.7.1. unfortunately, that version not installing now. don't know exactly what the problem is. However, I found a solution,

instead of "Ionic serve" command run the following command for the first time. then you will not need to run "ionic serve" each time.

npm run ionic:serve
0
votes

I had the same error when I updated Ionic. I worked around it by using:

ionic serve --address localhost

The above solution to use "@ionic/app-script": "1.2.2" works to have it use localhost instead of 0.0.0.0. However it created other errors that were easily fixed by following the addition warnings.

"devDependencies": { "@ionic/app-scripts": "1.2.2",

The one new error I still couldn't pinpoint yet is:

Error Close Runtime Error timeStamp.getDate is not a function Stack TypeError: timeStamp.getDate is not a function at HomePage.timeSince (http://localhost:8100/build/main.js:70141:33) at SafeSubscriber._next (http://localhost:8100/build/main.js:70088:42) at SafeSubscriber.__tryOrUnsub (http://localhost:8100/build/main.js:69844:16) at SafeSubscriber.next (http://localhost:8100/build/main.js:69793:22) at Subscriber._next (http://localhost:8100/build/main.js:69746:26) at Subscriber.next (http://localhost:8100/build/main.js:69710:18) at XMLHttpRequest.onLoad (http://localhost:8100/build/main.js:44518:38) at t.invokeTask (http://localhost:8100/build/polyfills.js:3:14051) at Object.onInvokeTask (http://localhost:8100/build/main.js:27788:37) at t.invokeTask (http://localhost:8100/build/polyfills.js:3:13987) Ionic Framework: 2.0.0-rc.2 Ionic Native: 2.2.3 Ionic App Scripts: 1.2.2 Angular Core: 2.1.1 Angular Compiler CLI: 2.1.1 Node: 6.9.1 OS Platform: Windows 10 Navigator Platform: Win32 User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36

The app does run but that window popped up on Chrome and I had to close it before I could see the output of the app.