salesforcedx-vscode: `force:project:create`command returns "ERR_ASSERTION: A name parameter is required to create a storage"

Summary

ERR_ASSERTION: A name parameter is required to create a storage error message when using SFDX:Create Project

Steps To Reproduce:

  1. install java via https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04
  2. Install SFDX CLI and salesforcedx-vscode into vscode
  3. run use SFDX: create project
  4. observe “ERR_ASSERTION: A name parameter is required to create a storage” in bottom console.

Note: running sfdx force:project:create --projectname testing --outputdir /home/neil/playground/salesforce/test in command line gives same error

Expected result

SFDX project should be created

Actual result

Error message in terminal: ERR_ASSERTION: A name parameter is required to create a storage

Additional information

VS Code Version:

Version 1.19.2 Commit 490ef761b76b3f3b3832eff7a588aac891e5fe80 Date 2018-01-10T15:57:21.071Z Shell 1.7.9 Renderer 58.0.3029.110 Node 7.9.0 Architecture x64

SFDX CLI Version: sfdx-cli/6.0.26-3d23012 (linux-x64) node-v8.6.0

OS and version: Ubuntu 16.04

**Java version: **: java version “1.8.0_151” Java™ SE Runtime Environment (build 1.8.0_151-b12) Java HotSpot™ 64-Bit Server VM (build 25.151-b12, mixed mode)

Internal Work Item: W-4241831

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 6
  • Comments: 16 (3 by maintainers)

Most upvoted comments

@vazexqi Weird, there was one package.json file without a name attribute in the root folder of the system directory, I deleted and the command run as expected.

@neildaemond - Thanks for filing this.

I suspect I know what the root cause is. Could you confirm if you have a package.json (without a “name” field) somewhere in the folder or in one of its ancestors?

We are tracking this internally as W-4241831 and our repro steps are:

  1. Create top level directory (test)
  2. cd into test
  3. touch package.json (this creates an empty package.json without any entries)
  4. run sfdx force:apex:class:create -n testclass (we repro this with force:apex:class:create but this will also affect sfdx force:project:create)

adding package.json with the contents

{
    "name": "<anything>"
}

Seems to allow it to work without the Mentioned Error (Although I have no Idea how that package.json should be written otherwise). Thanks!

For any one having this problem, look into your ~/, there’s probably a package.json with the sfdx plugins but no “name”. So you can just insert this line right after the first {: "name": "sfdx". Final result might look like this:

{ “name”: “sfdx”, “dependecies”: { plugins here… } }

sfdx --version : sfdx-cli/7.132.0 linux-x64 node-v16.13.2

It would be REALLY helpful to include a note about this issue in the instructions in the following Trailhead training module:

https://trailhead.salesforce.com/content/learn/projects/quickstart-vscode-salesforce/use-vscode-for-salesforce

because it seems highly likely that students may have played around with node and have random package.json files somewhere their directory hierarchy, and then when they try to follow the instructions, they get this really misleading error about not supplying a project name, when of course they actually did supply one!! Thanks!

To be clear, you do not have to search through the tens of package.json files on your computer looking for one without a name parameter. Instead, create a new file with the following contents: { “name”: “sfdx-company” } and save it in your new project directory.

PackageDotJsonCreated

Hi everyone, I would like to confirm (just for the next person 😃 ) that I was getting the same error and after seeing @angelsalazar 's comment I decided to check the root of my system and noticed that I had a random package.json file. I deleted it and everything worked fine.