[SalesForce] Running into a “A name parameter is required to create storage” when creating Apex Class w/ VSCode

I'm attempting to create an Apex Class a part of the Convert Lightning Web Components Open Source to Salesforce trailhead module and when I try to create a class on my mac, I run into this error.

sfdx force:apex:class:create –classname SessionController –template DefaultApexClass -n SessionController –outputdir force-app/main/default/classes
ERROR running force:apex:class:create: A name parameter is required to create a storage

Best Answer

https://github.com/forcedotcom/salesforcedx-vscode/issues/253

Using that issue discussion as reference. I would check that you don't have some package.json file without any name attribute in the root folder of the system directory.

Otherwise, even adding package.json with the name attribute seems to be the other suggested workaround

{
    "name": "<anything>"
}