25

I got this error when i run ionic serve The Ionic CLI will exit. Please check any output above for error details.

my ionic info

$ionic info
Ionic:

   ionic (Ionic CLI)  : 4.0.1 (C:\Users\Pc\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.1.8

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : android 7.0.0

System:

   Android SDK Tools : 25.3.1
   NodeJS            : v6.10.1 (C:\Program Files\nodejs\node.exe)
   npm               : 5.3.0
   OS                : Windows 10

Environment:

   ANDROID_HOME : C:\Users\Pc\AppData\Local\Android\sdk
yali
  • 1,038
  • 4
  • 15
  • 31

13 Answers13

44

Run the below command, being in root directory of Ionic project:

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

Then you can try Ionic serve or Ionic s.

CodeChanger
  • 7,953
  • 5
  • 49
  • 80
Rakesh Mishra
  • 472
  • 4
  • 3
8

I had a similar issue:

Assertion `args[1]->IsString()' failed.

A utility CLI has unexpectedly closed

I fixed that by installing natives lib through npm:

npm i natives
Community
  • 1
  • 1
Nourdine Alouane
  • 804
  • 12
  • 22
7

Simpy run

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

and then

ionic serve

This error is because of some audit during installing a plugin or adding a plug in

6

I had a similar issue. I tried several different solutions, and for some reason different ones worked on different machines. Because I'm an illogical masochist, I attempted to fix this issue in the same project on 3 different laptops instead of sending the new fixed version to the other laptops.

The best answer I came up with is to:

  • Delete node_modules
  • copy node_modules from a different project (I used an earlier version of my app)
  • run npm i to install any missing modules

I think this approach should work for almost all instances.

Jack M
  • 61
  • 1
  • 2
4

You must kill the NodeJs service I believe it's a bug

  • how can i kill it in windows10? can i close then open vscode again? or you mean stop start services? i run ionic serve in one of my projects. second one working good but first one didnt work as well and this error happened... i dont know why? when copy node_modules from first one to another thats worked fine. but after some days this error returned back to my house – saber tabatabaee yazdi Jun 26 '19 at 15:03
  • From the task manager, nodejs must appear to kill. Currently I am not facing this problem maybe it is necessary to update node – Vagner Sabadi Jun 27 '19 at 16:48
3

Try running:

npm install @ionic/lab
Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
3

Try replacing the package.json scripts parts. Worked for me.

  "scripts": {
    "build": "ionic build",
    "serve": "ionic build",
    "start": "npm run serve"
  },
1

Maybe there is an issue in your hosts file. Make sure your ::1 should enable or not commented.

Example:

enter image description here

Rahul Sharma
  • 622
  • 7
  • 25
0

I don't know why but using sudo was the only way to solve this on my ubuntu machine! I just needed to run the command using sudo:

sudo ionic serve
basilisk
  • 1,156
  • 1
  • 14
  • 34
0

Error: Lock found, but no process with PID 43470 seems to be running. [ng] (If you are sure no ngcc process is running then you should delete the lock-file at yourproject/node_modules/@angular/compiler-cli/ngcc/ngcc_lock_file.)

rm yourproject/node_modules/@angular/compiler-cli/ngcc/ngcc_lock_file

et voila.

0

if you get this in the log:

The target entry-point "@ionic-native/media-capture" has missing dependencies:

  • @ionic-native/core

try this,

npm install --save @ionic-native/core
nativelectronic
  • 646
  • 4
  • 11
0

My solution: Upgrade Angular. It'll reveal the real reason for unexpectedly closing in a more verbouse error message. Mine was incompatible dependencies. I simply edited package.json with the right depencies, and ran npm update

Cedric Ipkiss
  • 5,662
  • 2
  • 43
  • 72
0

For any Linux Users: This error might occur if you installed node.js via the snapstore. Either change PATH to /usr/local/bin/node or use npm to update/install node.js again at the right place.

B4ldur
  • 11
  • 2