Fixing CircuiTikZ Error: I do not know the key '/tikz/elmech'

Problem:

You want to compile a LaTeX file containing CircuiTikZ code but you get the following error:

Error: I do not know the key '/tikz/elmech'

Solution

First, be sure that the circuitikz package is included, i.e. there’s a line like

\usepackage{circuitikz}

in your LaTeX file.

If that is the case, you likely have an outdated CircuiTikZ version (elmech is in TeXLive 2016+).  Depending on your distribution, there are several ways to update CircuiTikZ:

For ubuntu, see this post to update to TeXLive 2016 For other distributions, see this post using tlmgr