luaotfload-tool can find fonts, but LuaLaTeX cannot find them to compile

I have otf Alegreya Sans Small Caps installed system wide:

luaotfload-tool --find="AlegreyaSansSC" --fuzzy luaotfload | resolve : Font "AlegreyaSansSC" found! luaotfload | resolve : Resolved file name "~/.local/share/fonts/AlegreyaSansSC-Regular.otf"

I also have ttf Alegreya:

luaotfload-tool --find="Alegreya" --fuzzyluaotfload | resolve : Font "Alegreya" found! luaotfload | resolve : Resolved file name "/usr/local/texlive/2017/texmf-dist/fonts/truetype/huerta/alegreya/Alegreya-%Regular.ttf"

But using them is a problem, because for some reason LuaLaTeX thinks they are non existent.

lualatex of the following file:

\documentclass [letterpaper,12pt]{scrartcl}
\usepackage {fontspec}
\setmainfont{TeX Gyre Schola}

\newfontfamily\myfont1{home/bob/.local/share/fonts/AlegreyaSansSC-Regular.otf}
\newfontfamily\myfont2{Alegreya}

\begin{document}

Hail the bows of war the clash of titans, the rude dogs of destiny.

{\myfont1 Make the halls of bows of holly, titan lala la tr la la la}

{\myfont2 Hallelujah the time is now!}

\end{document}


produces this:

Any help in troubleshooting would be appreciated.

• Do yourself a favor and get your copy of Alegreya Sans directly from the foundry (github.com/huertatipografica/Alegreya-Sans), because it has many more glyphs than the version included in TeX Live. Having done that, this works for me: \setsansfont{Alegreya Sans}[SmallCapsFont={* SC},ItalicFeatures={SmallCapsFont={Alegreya Sans SC Italic}}] – Thérèse Jan 6 '18 at 5:12
• Why are you loading luatexbase? – Thérèse Jan 6 '18 at 5:28
• Thanks, I'll try that. luatexbase is being loaded because I'm using this with a lua script that needs that in order to work. I don't get why some fonts seem to install fine, and others like Alegreya don't seem to be recognized. Its pretty frustrating. I still would like to have a way to arbitrarily ask an otf font to load and reliably be able to use it. – A Feldman Jan 6 '18 at 5:37
• ~ is an active character expanding to \penalty and \hspace so probably not too useful in a font name without some care – David Carlisle Jan 6 '18 at 10:44
• you should not be loading luatexbase (almost ever) or luatex85 (unless you really are using some package that has not been updated in the last two years and needs that compatibility layer) – David Carlisle Jan 6 '18 at 10:45

The error message shown is

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
!
! The font "1" cannot be found.
!
! See the fontspec documentation for further information.
!
! For immediate help type H <return>.
!...............................................

l.7 \newfontfamily\myfont1{
~/.local/share/fonts/AlegreyaSansSC-Regular.otf}
?


Note the linebreak showing that TeX has not yet read ~/.local/share/fonts/AlegreyaSansSC-Regular.otf} so it is not looking for a font called AlegreyaSansSC it is looking for a font called 1 and:

The font "1" cannot be found.


Note that

\newfontfamily\myfont1


is the same as

\newfontfamily\myfont{1}


Just as \fbox1 is \fbox{1} with a boxed 1 not a command called fbox1