Mebin Xtapps
Mebin Xtapps

Reputation: 51

Ionic serve not working in Ionic 3

My Ionic info:

cli packages: (/usr/lib/node_modules)

@ionic/cli-utils  : 1.9.2
ionic (Ionic CLI) : 3.9.2

global packages:

Cordova CLI : 7.0.1 

local packages:

@ionic/app-scripts : 3.1.0
Cordova Platforms  : browser 4.1.0
Ionic Framework    : ionic-angular 3.9.2

System:

Node : v6.9.0
npm  : 3.10.8 
OS   : Linux 4.4

Ionic serve is working fine, but does not detect any file changes!

The problem appears only for Ionic v3 and v2 projects.

My Ionic v1 projects are working fine.

Upvotes: 1

Views: 12254

Answers (20)

Basil Basaif
Basil Basaif

Reputation: 372

What Worked for me was repairing the project ionic repair , then I ran ionic serve and it worked fine. Hope this solves your problem.

Upvotes: 0

Galilo Galilo
Galilo Galilo

Reputation: 569

I have faced such a problem, tried a fresh new app, worked perfectly, tried another old app, also worked perfectly.

Tried to stop using some modules (clipboard in my case and another one), solved the problem, in my case it was an error in the way I am importing or using it.

ionic 5 is my ionic version

Hope this will help someone

Upvotes: 0

Ali Mhanna
Ali Mhanna

Reputation: 397

i faced this problem before ,try this instead of ionic serve :

npm run ionic:serve

Upvotes: 1

Sandip Moradiya
Sandip Moradiya

Reputation: 726

Include below script in the package.json file

"browser": "ionic-app-scripts serve --sourceMap source-map --iscordovaserve --wwwDir platforms/browser/www/ --buildDir platforms/browser/www/build"
and run

After It Run npm run browser

Upvotes: 0

Shahid Mirza
Shahid Mirza

Reputation: 11

Delete the node_modules folder and then use the command

npm install

followed by

ionic serve--verbose

Hope that it works fine.

Upvotes: 1

Ed C. Manson Ally
Ed C. Manson Ally

Reputation: 1

My answers works. My machine is also having a different package of Node which I forgot about in the first place.

So I've removed node_modules using:

sudo rm -rf /opt/local/bin/node /opt/local/include/node /opt/local/lib/node_modules
sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node.1 /usr/local/lib/dtrace/node.

To make things less complicated with all cli - head up back https://nodejs.org/ and install back the LTS package

Uninstall Node from brew
re-install node.js using conventional way using the installer

Upvotes: 0

rhanesoghlyan
rhanesoghlyan

Reputation: 53

Please use these commands in your project.

sudo sysctl fs.inotify.max_user_watches=524288

sudo sysctl -p --system

And again run ionic serve

Upvotes: 1

federico scamuzzi
federico scamuzzi

Reputation: 3778

I think your prob is the

NODE version (6.9.1) .. 

can you just try to upgrade to 9.1.0 or more?

Upvotes: 0

Mukesh smk
Mukesh smk

Reputation: 1

Have you tried using this cmd

npm run ionic:serve

Upvotes: 0

Ashay
Ashay

Reputation: 43

In ionic 3 you have to type:

  • cordova run android or cordova run ios, to deploy your build in device.

  • cordova build android or cordova build ios, for build only.

Upvotes: 0

Pawwa
Pawwa

Reputation: 43

Try below steps.. May be it will help

npm install -g ionic@latest

npm install @ionic/app-scripts@latest --save-dev

npm install ionic-angular@latest --save

ionic serve

Upvotes: 1

yassine guadina
yassine guadina

Reputation: 1

Install ws:

npm install [email protected] --save-dev --save-exact

Upvotes: 0

EricSky1204
EricSky1204

Reputation: 1

Use these commands in your prompt.

npm cache clear --force
rm -rf node_modules/
npm install -d

Upvotes: 0

shub_evil
shub_evil

Reputation: 1

my configurations for running ionic 3 application:

cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.19.1
ionic (Ionic CLI) : 3.19.1

global packages:

cordova (Cordova CLI) : 8.0.0 

local packages:

@ionic/app-scripts : 3.1.7
Cordova Platforms  : android 6.3.0
Ionic Framework    : ionic-angular 3.9.2

System:

Android SDK Tools : 26.1.1
Node              : v8.2.1
npm               : 5.5.0 
OS                : Linux 4.4

Environment Variables:

ANDROID_HOME : /root/Android/Sdk

Misc:

backend : pro

Upvotes: 0

Charles Zhao
Charles Zhao

Reputation: 186

You should not use "sudo" with any of the ionic/npm commands. If it throws error without "sudo", then you can fix it by changing the owner of the npm packages, using the command below:

sudo chown -R $(whoami) ~/.npm

Upvotes: 0

core114
core114

Reputation: 5325

Try like this

ionic serve --verbose =>didn’t work, there were errors;

npm run ionic:build --verbose =>ran, finnished with OK.

Upvotes: 3

Lili
Lili

Reputation: 1

When I use ionic cli build app(ionic3 + angular5),same problem happened to me.I updated '@ionic/app-scripts' to version '3.1.6',then problem solved

Upvotes: 3

alchi baucha
alchi baucha

Reputation: 1040

Try npm run ionic:serve. Similar issue occurred when installing the latest cordova update.

Upvotes: 1

PravinSanghani
PravinSanghani

Reputation: 129

For update changes in platform file you have to run ionic cordova prepare and then run ionic serve it works.. ionic cordova prepare copy all files of www into platform directory that will reflect in your apk or ipa

Upvotes: 3

CThakur
CThakur

Reputation: 136

Use "npm install" and then "gulp build" & "gulp serve". Also make sure you update all the dependencies. Check versions of your dependencies by "ionic info".

Upvotes: 1

Related Questions