'ionic serve' is failing without an error


#1

After weeks of development with no problems, I am suddenly having trouble serving up my App in a browser. Using ‘grunt serve’ I get an error: ‘Warning: Task “ionic:serve” failed.’ and am unable to view my app in a browser, with the ‘Connection Refused’ error showing in Chrome. If I try and run ‘ionic serve’, the node server seemingly starts, and then just stops without showing any error. I have removed and reinstalled ionic, cordova, and even npm, and have rolled back my project to a known working git commit, all to no avail. I have also tried running ‘ionic serve’ with a fresh clone of ionic-starter-tabs, also to no avail.
Has anyone else had this problem, and if so, how did you solve it?
Thanks in advance!


#2

Maybe you can try run node server its very esay


#3

Looks similar to the problem I’m having. Ionic CLI unexpectedly exists Let’s k


#4

…let’s keep eachother informed if we find a solution to this.


#5

For sure. I haven’t found a solution yet. I tried running it with node server as @vitaly87 suggested and that worked, but it’s kind of a pain not to have the convenience of ‘ionic serve’. Think I’m gonna drop back to a previous version of ionic.


#6

This happened to me but only when I accidentally launched ionic serve while there was already another ionic serve process running.


#7

Yeah I’ve made sure there are no other servers running.


#8

I’ve had the same problem a while ago. The problem was with the angular and Ionicbundle versions (I doubt it is your problem) because I fiddled around and broke everything.
So, stupid question, have you tried to run ionic serve -c and to investigate the app log? It helped me a lot.


#9

Hey @Tyranneo, forgot to update this. I managed to fix the problem, which was caused due to upgrading Cordova, and me forgetting to set a Content Security Policy. Thanks for responding though.


#10

I have solved the problem by re-installing bower, node and grunt completely on my Mac.

sudo rm -Rf /usr/local/lib/node_modules
cd
rm -Rf .npm .npmrc .node .node-gyp/

Then re-install nodeJS from https://nodejs.org/download/ and then:

sudo npm install -g bower
sudo npm install -g grunt-cli
sudo npm install -g cordova
sudo npm install -g ionic

And I was back on track…

Hope this helps …