# Undefined Control Sequence on First Line of .sty

I'm very new to LaTeX and keep getting "Undefined Control Sequence" with the very first line of my attempt to test creating my own .sty package. Here's the code:

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{blah}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{EB Garamond 12}

• Make sure you are not actually trying to compile the sty file itself. That won't work. – Steven B. Segletes Nov 9 '18 at 12:25
• the only purpose of the \NeedsTeXFormat{LaTeX2e} command is to generate an error if the file is used with a format other than LaTeX2e, so most likely you are using plain TeX rather than LaTeX. (pdftex command rather than pdflatex) – David Carlisle Nov 9 '18 at 12:43
• Are you trying to run TeX on the .sty file? – egreg Nov 9 '18 at 13:40