function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Daniel RobertsDaniel Roberts 

sfdx force:apex:execute Error: Compilation Failed

$ sfdx force:apex:execute -u ApexDevHub -f force-app/main/default/triggers/HelloWorldTrigger.trigger
ERROR:  Compilation failed.
 !    ERROR: Line: 1, Column: 1
 !    Unexpected token 'trigger'.
ERROR:  Execution failed.

Hey guys  trying to get into SFDX, but testing a trigger is a bit of a challenge. 

Here is the code that I'm running and the error that I'm getting. I think it might be related to my Java version not accessing the APEX language server. Any help would be great. Thanks, 

Daniel RobertsDaniel Roberts
I think that I answered my own question. It doesn't make sense to actually test a trigger from the CLI, since they have to be fired on a DML statement. The way to test them from the CLI then, is to actually push them to an org and "trigger" them with the command they have been configured for.