Oh, okay, I see.
Well, I dusted off my LastFM account just to test, and I don't get any error with the following code:
$(eval '$(twitch $(channel) "{{status}}")' === 'live' ? '$(lastfm LASTFM_USERNAME "{{title}} by {{artist}}")' : ' ';)
What I think happened is that the quotes in your code were updated from " and ' to “” and ‘’, which usually happens when the code is copied in a word processor app, such as Microsoft Word for example, the issue is that JavaScript doesn't recognize the latter quotes. To avoid it, copy/paste the code we provide on the forum directly in your Twitch chat, or in Nightbot's dashboard, and edit the code there, or use a note app, they don't usually format the quotes, such as Notepad for example.