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

Created on 12 Jan 2018  路  14Comments  路  Source: forcedotcom/salesforcedx-vscode

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(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)

Internal Work Item: W-4241831

bug

Most helpful comment

@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.

All 14 comments

@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!

Any updates, this issue is still happening on sfdx version
sfdx-cli/6.15.0-ded9afdffb (darwin-x64) node-v8.9.4

@angelsalazar - Do you have a top-level and malformed package.json (a package.json without "name" is it) somewhere in your current folder's ancestor?

@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.

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.

Thanks for the update!

This is very weird and was happening to all my directories because guess what there was a package.json in my c drive. I am baffled as to what is the cause of this error. Its not even like we can't create more components in a bundle which is packaged already. any clue experts whats going on here... I a noob to know the intricacies but this was reported a year back and here I am experiencing this same behavior. What gives?

The error screen attached
image

@miteshmsharma it seems to just be a requirement of npm: https://docs.npmjs.com/files/package.json.html. I just got the same error all of a sudden after I added a set of Jest tests for LWC. @neildaemond's suggestion removes the error, but I am not exactly sure why sfdx requires the name attribute. I personally just added "name": "sfdx-company" to my package.json and it works fine. Also curious why this is needed at a higher level though.

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

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!

I'm facing this error again with salesforce VSCcode extensions v49.7

We are facing this error again on 7.83 with salesforcedx 50.9.1.
The error details:
ERROR running force:project:create: A name parameter is required to create a storage

dx #sfdx

Was this page helpful?
0 / 5 - 0 ratings