NPM Python Error

When you try to install NPM packages, some of the dependencies might use Python. E.g sqlite3's NPM package uses python during installation. NPM will look for python. When trying to install sqlite3 you might get the following error:

/bin/sh: 1: python: not found npm

The error occurs because it tries to find the Python dependency, but on newer systems the version 3.x of Python is installed and not 2.x. Python 3.x is usually aliased under python3 and not python. A simple solution would be to create a symbolic link for the alias python to reference python3

To create a symbolic link from python to python3 use the following command.

sudo ln -s /usr/bin/python3 /usr/bin/python

If you run the command:

ll /usr/bin/python

You should get a similar result:

/usr/bin/python -> /usr/bin/python3*

Support

If you want to support this blog you can do so by signing up to DigitalOcean using this referral link.