0

When I am running following SFDX command sfdx force:project:create --projectname mywork getting the following error Invalid version: "1.0"

No other SFDX command gives me this error. Any idea ?

4
  • Are you creating the project in an existing project directory? I suspect that might be the problem.
    – sfdcfox
    Commented Jul 18, 2018 at 21:07
  • No I am creating outside an existing sfdx project. Commented Jul 18, 2018 at 21:35
  • Can you tell us more about: your project structure, and share the way you're using the command (parameters, etc.). I'm pretty sure attempting to make your project folder outside of a SFDX project will fail as force:source:push and other metadata commands require there to be a DX-based source folder, and that needs to be in a dx project.
    – pchittum
    Commented Jul 20, 2018 at 6:30
  • Did you ever find a solution to this? If so please share it as I'm currently having the same problem!
    – ministe
    Commented Dec 22, 2020 at 10:05

1 Answer 1

0

This is an old question but its never been answered and I wanted to help others who may find themselves here like I did. I posted this issue on the sfdx github project and received a solution:

https://github.com/forcedotcom/cli/issues/775#issuecomment-754181203

To quote the solution:

In the current working directory where you are running the project create command, does somewhere up the path exist a package.json file with the version property specified as "version": "1"?

For example:

Running force:project:create in this directory: /Users/xxx/Desktop/sfdx/

When a package.json file exists here: /Users/xxx/package.json

and in that file is "version": "1", which is an invalid semver pattern.

There is a weird behavior of the yeoman-generator module that powers the template create commands where it traverses up the current working directory and validates some package.json file it finds. You can either delete this file or set the version to a valid semver number.

I hope this helps somebody!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .