ionic4 core dumped error on ionic serve: can I fix this by using a different node/npm version?

490 Views Asked by At

I am attempting to use Ionic 4 to build a cross platform mobile app.

The problem is that I cannot serve my app to view and test it.

I need help determining whether this is an issue with my versions/installations of ionic/node/npm, or something else.

I use ionic serve and receive a message at the end of the output that there was a segmentation fault (core dumped).

I have tried updating both node and npm to the most recent LTS versions, overwritten the app, created a new app under a different name/directory, and used various approaches to reinstall the node dependencies.

Note: I am using vscode with WSL as my environment.

My output is as follows:


ionic serve
> ng run app:serve --host=0.0.0.0 --port=8100
[ng] WARNING: This is a simple server for use in testing or debugging Angular applications
[ng] locally. It hasn't been reviewed for security issues.
[ng] Binding this server to an open connection can result in compromising your application or 
[ng] computer. Using a different host than the one passed to the "--host" flag might result in
[ng] websocket connection issues. You might need to use "--disableHostCheck" if that's the
[ng] case
Segmentation fault (core dumped)

I expected a new browser tab to open and display the local test environment for ionic apps. I have seen other questions posted to the effect that node and npm versions can be incompatible with newer releases of Ionic, but I haven't the foggiest where to look up such compatibility on the ionic or node/npm pages, even though I'm usually pretty good at finding things.

PS: I am currently in the throes of an internet outage affecting my area, so if this could just be bad connectivity please tell me so, and we'll pray together that my ISP gets things fixed quickly.

PPS: This is my first posted question, so please be patient with any naivety or awkwardness on my part. I hope you find it funny more than annoying.

2

There are 2 best solutions below

1
On

you can try with sudo, (sudo ionic serve)

0
On

I solved this issue as follows:

  • Update Node/NPM.
  • Change mode from Production to Development.
  • Change id of "widget" in the ionic app's "config.xml" file.
  • Install dependencies as prompted by ionic cli.
  • Use sudo to elevate permissions of specific installation commands as needed, (Linux/WSL).

If I missed anything or mentioned something that is inaccurate, please comment or post the correct answer.