Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ionic 4 - Getting [ERROR] ng has unexpectedly closed (exit code 1) when I run "ionic server"

I am struggling in this error when I try the first run on an Ionic4 project.

ng run app:serve --host=0.0.0.0 --port=8100

[ERROR] ng has unexpectedly closed (exit code 1).

  The Ionic CLI will exit. Please check any output above for error details.

I'm using Linux Elementary OS (a nice distro that came from Ubuntu).

I tried to run a ionic3 project and it ran successfully.

When I run ionic serve --verbose I get this message

enter image description here

I already tried many things, "npm cache clean", reinstall node, reinstall ionic, start/stop nodejs process. But without any success. As I am not finding anyone with the exactly same problem as mine I am asking you guys.

like image 595
rochasdv Avatar asked Jan 28 '23 07:01

rochasdv


2 Answers

Re-install below package...

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

And just change PATHEXT if there is space or ; at last then remove it

like image 64
Prakash Avatar answered Jan 31 '23 22:01

Prakash


1: open your project root folder

2: delete node_modules folder

3: run npm install

This solution worked... i hope this helps!

like image 28
RRR Avatar answered Jan 31 '23 22:01

RRR