When you install Node.js, the below path is added to the Windows OS %Path% variable, I'm presuming similar happens on other operating systems as well:
C:\Users\<your-windows-username>\AppData\Roaming\npm
In my case, because I use a work Windows laptop for an employer that severely restricts what employees can do on their machines (I.e. many actions require elevated admin privileges), Node.js was being prevented from adding the above path to the Windows %Path%
environment variable, and much to my chagrin the Node.js installation was silent about it. Navigate to above folder and you will notice the express
command lives there, see screenshot below.
How did I figure this out? I did a fresh installation of Node.js on a personal, home Windows machine that has no admin privilege restrictions like my work machine does, compared the before and after %Path%
value, and noticed the addition of that path. My work machine was missing it.
I had no choice but to add the path manually to %Path%
, and then express
was recognized from within any path I ran it.
