Ionic uses node-sass, which is a deprecated library that uses an old version of node-gyp, which requires Python 2. For Node 14 on MacOS x86_64 there is a precompiled version, so you don't need to install Python 2, but if you have Apple Silicon, npm has to build this dependency for you.
You can download Python 2 from the official Python website but they do not have a version for Apple Silicon. MacPorts does have a version for Apple Silicon, Homebrew does not. Using Rosetta 2 may also work to run the x86_64 version.
To install the version for your architecture on MacOS using MacPorts:
sudo port install python27
sudo port select --set python2 python27
sudo port select --set python python27
This makes two symlinks, /opt/local/bin/python2
and /opt/local/bin/python
.
If you don't want python
to refer to Python 2, you can remove one or both
symlinks when you've successfully built the app.