Search code examples
angularionic-frameworkionic4

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.


Solution

  • The problem was my version of NodeJS and JDK.

    I used "nvm use 8.12.0" to point to supported node version. Also I have to change the version of my JDK, I used openJDK 8.