npmnpm-init

What is the 'npm create' command?


As the UmiJS documentation suggests, a project is created with the npm create command:

npm create umi

It seems to be working, but it's not documented.

Why did it appear and when? Is it a full synonym for npm init? Is there a reason why npm create should or should not be used?


Solution

  • To answer this question, I ran:

    npm create --help
    

    which printed:

    npm init [--force|-f|--yes|-y|--scope]
    npm init <@scope> (same as `npx <@scope>/create`)
    npm init [<@scope>/]<name> (same as `npx [<@scope>/]create-<name>`)
    
    aliases: create, innit
    

    So yes, it is a synonym, or more specifically an alias, for npm init.

    This was done using npm 6.10.1.

    It doesn't matter which command one uses, but init is the canonical form while create is an alias. This is evidenced by the fact that npm create --help actually invokes npm init --help which is why we see create listed as an alias in this above output.